Merge pull request #271 from physicshub/dependabot/npm_and_yarn/basic… #236
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
| # .github/workflows/contributors.yml | |
| name: Update Contributors | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths.ignore: | |
| - ".all-contributorsrc" | |
| workflow_dispatch: | |
| jobs: | |
| update-contributors: | |
| runs-on: ubuntu-latest | |
| # AGGIUNTO: Concede i permessi di scrittura al token per eseguire il push. | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| # È consigliato usare 'v4' per l'azione checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| - name: Install dependencies | |
| run: npm install --legacy-peer-deps | |
| - name: Run contributors script | |
| run: npm run contributors | |
| env: | |
| # Secret token with permissions to get contributors data | |
| GH_TOKEN: ${{ secrets.GH_TOKEN }} | |
| - name: Commit and push changes | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "docs: update contributors" | |
| # MODIFICATO: Usa il token di GitHub per autenticare l'operazione di push. | |
| git push https://${{ github.token }}@github.com/${{ github.repository }}.git HEAD:main |