Repository navigation
Contributor credit #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | |
| - cron: '0 0 1 * *' # At 00:00 on day-of-month 1 | |
| workflow_dispatch: | |
| jobs: | |
| update_credit: | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| name: Update | |
| runs-on: ubuntu-latest | |
| env: | |
| GH_TOKEN: ${{ secrets.MNE_BOT_TOKEN }} | |
| GITHUB_TOKEN: ${{ secrets.MNE_BOT_TOKEN }} | |
| steps: | |
| - uses: actions/checkout@v7.0.1 | |
| with: | |
| persist-credentials: true | |
| - uses: actions/setup-python@v7.0.0 | |
| - run: pip install pygithub sphinx -e . | |
| - run: python tools/dev/update_credit_json.py | |
| - run: git add -f doc/sphinxext/prs/*.json | |
| # Resolve contributor names, appending .mailmap entries for any new | |
| # contributors whose names need verification (listed in the PR body) | |
| - run: python doc/sphinxext/credit_tools.py --fix-mailmap --report $RUNNER_TEMP/credit-report.md | |
| - run: git add .mailmap | |
| - 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 "50266005+mne-bot@users.noreply.github.com" | |
| git config --global user.name "mne[bot]" | |
| BRANCH=credit/$(date '+%Y%m%d') | |
| git checkout -b $BRANCH | |
| git commit -am "mne[bot]: Update code credit [skip azp] [skip actions]" | |
| git push origin $BRANCH | |
| echo "Created by credit [GitHub action](https://github.com/mne-tools/mne-python/actions/runs/${{ github.run_id }})." > $RUNNER_TEMP/body.md | |
| echo "" >> $RUNNER_TEMP/body.md | |
| cat $RUNNER_TEMP/credit-report.md >> $RUNNER_TEMP/body.md | |
| PR_NUM=$(gh pr create --base main --head $BRANCH --title "MAINT: Update code credit" --body-file $RUNNER_TEMP/body.md --label "no-changelog-entry-needed") | |
| echo "Opened https://github.com/mne-tools/mne-python/pull/${PR_NUM}" >> $GITHUB_STEP_SUMMARY | |
| if: steps.status.outputs.dirty == 'true' |