Update Contributors #10
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: Update Contributors | |
| on: | |
| schedule: | |
| - cron: '0 0 * * 6' # Sat 00:00 UTC | |
| workflow_dispatch: | |
| jobs: | |
| generate-markdown-and-create-pr: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 18 | |
| - name: Set up tool | |
| run: npm install -g [email protected] | |
| - name: Generate file | |
| id: generate | |
| run: npx all-contributors generate | |
| - name: Create PR with changes | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| if ! git diff --quiet CONTRIBUTORS.md; then | |
| BRANCH_NAME="update-contributors-$(date +%d-%m-%Y)" | |
| git checkout -b "$BRANCH_NAME" | |
| git add CONTRIBUTORS.md | |
| git commit -m "[AUTOMATED] update CONTRIBUTORS.md" | |
| git push origin "$BRANCH_NAME" | |
| gh pr create \ | |
| --title "[MNT] all-contributors update" \ | |
| --body "Automated update to CONTRIBUTORS.md from .all-contributorsrc changes. | |
| Generated by [workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})." \ | |
| --head "$BRANCH_NAME" \ | |
| --base main | |
| echo "changes_detected=true" >> $GITHUB_ENV | |
| echo "branch_name=$BRANCH_NAME" >> $GITHUB_ENV | |
| else | |
| echo "No changes to commit." | |
| echo "changes_detected=false" >> $GITHUB_ENV | |
| fi | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| - name: Echo Results | |
| if: steps.candp.outputs.changes_detected == 'true' | |
| run: echo "changes detected and committed." |