-
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (35 loc) · 1.42 KB
/
sync_feed.yml
File metadata and controls
42 lines (35 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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