-
Notifications
You must be signed in to change notification settings - Fork 1.3k
47 lines (44 loc) · 1.63 KB
/
credit.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
name: Contributor credit
on: # yamllint disable-line rule:truthy
# Scheduled actions only run on the main repo branch, which is exactly what we want
schedule:
# TODO: After making sure it works in `main` for a while, switch to monthly
# - cron: '0 0 1 * *' # first day of the month at midnight
- cron: '0 0 * * *' # every day at midnight
# TODO: Remove before merge
pull_request:
branches:
- main
permissions:
pull-requests: write
jobs:
update_credit:
name: Update
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- run: pip install pygithub -e .
- run: git checkout -b credit
- run: python tools/dev/update_credit_json.py
- run: python tools/dev/update_credit_rst.py
- run: git add -f doc/sphinxext/prs/*.json
- run: |
git diff && git status --porcelain
if [[ $(git status --porcelain) ]]; then
echo "dirty=true" >> $GITHUB_OUTPUT
fi
id: status
- name: Create PR
run: |
set -xeo pipefail
git config --global user.email "114827586+autofix-ci[bot]@users.noreply.github.com"
git config --global user.name "autofix-ci[bot]"
git commit -am "MAINT: Update code credit"
gh pr create -B main -H credit --title "MAINT: Update code credit" --body "Created by \"${{ github.workflow }}\" GitHub action." --label "no-changelog-entry-needed"
if: steps.status.outputs.dirty == 'true'