Sync #142
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: Sync | |
| # Refreshes star counts, removes archived and deleted repositories, and | |
| # regenerates README.md and the badges. Runs nightly, after every merge that | |
| # touches the list or the tooling, and on demand. | |
| on: | |
| schedule: | |
| - cron: "17 3 * * *" | |
| push: | |
| branches: [main] | |
| paths: | |
| - list.json | |
| - "entries/**" | |
| - "links/**" | |
| - go.mod | |
| - "cmd/**" | |
| - "internal/**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: sync | |
| cancel-in-progress: false | |
| jobs: | |
| sync: | |
| name: Refresh, prune, generate | |
| runs-on: ubuntu-latest | |
| steps: | |
| # main is protected; the bot pushes with a write deploy key that the | |
| # ruleset exempts. GITHUB_TOKEN cannot bypass rules on a user-owned repo. | |
| - uses: actions/checkout@v4 | |
| with: | |
| ssh-key: ${{ secrets.SYNC_DEPLOY_KEY }} | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| - name: Sync | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: go run ./cmd/awesome sync | |
| - name: Commit and push | |
| run: | | |
| if [ -z "$(git status --porcelain)" ]; then | |
| echo "Nothing changed." | |
| exit 0 | |
| fi | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add -A | |
| git commit -m "chore: refresh stars, prune dead repositories, regenerate README and badges" | |
| git push |