Skip to content

Periodic update of MAINTAINERS.md #197

Periodic update of MAINTAINERS.md

Periodic update of MAINTAINERS.md #197

# 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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: "Setup Python"
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.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 '[email protected]'
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 }}