Fix: Authenticate git push and script env var with PAT_TOKEN in update-readme workflow #14
Workflow file for this run
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 Org Leaderboard | |
| on: | |
| push: | |
| branches: | |
| - main # or your default branch | |
| pull_request: | |
| types: [opened, closed] | |
| issues: | |
| types: [opened, edited, closed] | |
| pull_request_review: | |
| types: [submitted] | |
| workflow_dispatch: # manual trigger | |
| jobs: | |
| update-readme: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '20' | |
| - name: Generate leaderboard | |
| run: node profile/scripts/updateReadme.js | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }} | |
| - name: Commit & push changes | |
| env: | |
| PAT_TOKEN: ${{ secrets.PAT_TOKEN }} | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git remote set-url origin https://x-access-token:${PAT_TOKEN}@github.com/${{ github.repository }}.git | |
| git add profile/README.md | |
| git commit -m "Update leaderboard" || echo "No changes" | |
| git push origin HEAD:main |