Sync & Generate Feeds #346
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 & Generate Feeds | |
| on: | |
| schedule: | |
| - cron: '0 */2 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| sync-feeds: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fetch source feed | |
| run: | | |
| mkdir -p feeds | |
| curl -sSfL \ | |
| "https://raw.githubusercontent.com/mthcht/awesome-lists/refs/heads/main/Lists/VSCODE%20Extensions/feeds/vsxsentry_feed.json" \ | |
| -o feeds/vsxsentry_feed.json | |
| echo "Source records: $(python3 -c "import json; print(len(json.load(open('feeds/vsxsentry_feed.json')).get('records',[])))")" | |
| - name: Generate all feed formats | |
| run: python3 generate_feeds.py | |
| - name: Check for changes | |
| id: diff | |
| run: | | |
| git add feeds/ | |
| git diff --cached --quiet && echo "changed=false" >> "$GITHUB_OUTPUT" || echo "changed=true" >> "$GITHUB_OUTPUT" | |
| - name: Commit and push | |
| if: steps.diff.outputs.changed == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| COUNT=$(python3 -c "import json; print(len(json.load(open('feeds/vsxsentry_feed.json')).get('records',[])))" 2>/dev/null || echo "?") | |
| FILES=$(git diff --cached --name-only | wc -l) | |
| git commit -m "feed: sync & generate ${FILES} files (${COUNT} records)" | |
| git push |