Skip to content

Periodic update of MAINTAINERS.md #144

Periodic update of MAINTAINERS.md

Periodic update of MAINTAINERS.md #144

# 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@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
with:
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
- name: "Checkout"
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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 '[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 }}