Update GitHub Dependents #5
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 GitHub Dependents | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * 0" # Every Sunday at midnight UTC | |
| permissions: {} | |
| jobs: | |
| update-dependents: | |
| permissions: | |
| contents: write | |
| packages: read | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 | |
| - name: Setup Node.js and pnpm | |
| uses: ./.github/actions/setup-node-pnpm | |
| - name: Run fetch-github-dependents | |
| run: node tools/fetch-github-dependents.mjs | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Check for changes | |
| id: git-check | |
| run: | | |
| if git diff --exit-code data/dependents.json; then | |
| echo "No changes detected in dependents.json" | |
| echo "changes=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "Changes detected in dependents.json" | |
| echo "changes=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit and push changes | |
| if: steps.git-check.outputs.changes == 'true' | |
| run: | | |
| git config --local user.email "[email protected]" | |
| git config --local user.name "Boshen" | |
| git add data/dependents.json | |
| git commit -m "chore: update github dependents" | |
| git push origin main | |
| - name: No changes to commit | |
| if: steps.git-check.outputs.changes != 'true' | |
| run: echo "No changes to commit" |