Update Repos Cache #130
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 Repos Cache | |
| on: | |
| push: | |
| branches: [ main ] | |
| schedule: | |
| - cron: '0 */6 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| update-repos: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repo | |
| uses: actions/checkout@v4 | |
| - name: Fetch and cache repos | |
| run: | | |
| curl -H "Accept: application/vnd.github.v3+json" \ | |
| "https://api.github.com/users/DevArqf/repos?sort=updated&per_page=50" \ | |
| -o raw-repos.json | |
| node -e " | |
| const repos = require('./raw-repos.json'); | |
| const exclude = ['DevArqf', 'devarqf.github.io', 'WIMMG', 'Portfolio Ideas', 'API-Header-Spoofer']; | |
| const filtered = repos | |
| .filter(r => !r.fork || r.name === 'create-discobase') | |
| .filter(r => !exclude.includes(r.name)); | |
| require('fs').writeFileSync('repos.json', JSON.stringify(filtered, null, 2)); | |
| " | |
| - name: Commit and push if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add repos.json | |
| git diff --quiet && git diff --staged --quiet || (git commit -m "Update repos cache" && git push) |