Skip to content

Periodic update of MAINTAINERS.md #165

Periodic update of MAINTAINERS.md

Periodic update of MAINTAINERS.md #165

# SPDX-License-Identifier: Apache-2.0
name: Periodic update of MAINTAINERS.md
on:
schedule:
- cron: '0 0 * * *' # Runs every day at 00:00 UTC
workflow_dispatch: # Allow manual trigger
env:
LC_ALL: en_US.UTF-8
defaults:
run:
shell: bash
jobs:
update-maintainers:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: "Harden Runner"
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: "Checkout"
uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
fetch-depth: 0
- name: "Setup Python"
uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.11"
- name: "Install Python Packages"
run: |
pip install -r tools/maintainers/requirements.txt
- name: Update maintainers page
run: |
tools/maintainers/maintainers.py tools/maintainers/teams.yaml > MAINTAINERS.md
env:
GH_TOKEN: ${{ secrets.ORG_ACCESS_TOKEN }}
- name: Check for changes
id: git-diff
run: |
echo "changed=$(git diff --quiet --exit-code -- MAINTAINERS.md; echo "$?")" >> "$GITHUB_OUTPUT"
- name: Create Pull Request
if: steps.git-diff.outputs.changed == '1'
run: |
git config --global user.name 'Maintainers Update Bot'
git config --global user.email 'ci@instructlab.ai'
git checkout -b maintainers-update
git add -- MAINTAINERS.md
git commit -s -m "MAINTAINERS.md: automated update"
git push -u -f origin maintainers-update
if ! (gh pr list --head maintainers-update --json number | grep -q "number") ; then
gh pr create --title "MAINTAINERS.md: automated update" --body "Automated update of MAINTAINERS.md"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}