Skip to content

Commit 718479e

Browse files
committed
add fetch-github-dependents cron
1 parent 75cf299 commit 718479e

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Update GitHub Dependents
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: "0 0 * * 0" # Every Sunday at midnight UTC
7+
8+
permissions: {}
9+
10+
jobs:
11+
update-dependents:
12+
permissions:
13+
contents: write
14+
packages: read
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
21+
22+
- name: Setup Node.js and pnpm
23+
uses: ./.github/actions/setup-node-pnpm
24+
25+
- name: Run fetch-github-dependents
26+
run: node tools/fetch-github-dependents.mjs
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Check for changes
31+
id: git-check
32+
run: |
33+
if git diff --exit-code data/dependents.json; then
34+
echo "No changes detected in dependents.json"
35+
echo "changes=false" >> $GITHUB_OUTPUT
36+
else
37+
echo "Changes detected in dependents.json"
38+
echo "changes=true" >> $GITHUB_OUTPUT
39+
fi
40+
41+
- name: Commit and push changes
42+
if: steps.git-check.outputs.changes == 'true'
43+
run: |
44+
git config --local user.email "[email protected]"
45+
git config --local user.name "Boshen"
46+
git add data/dependents.json
47+
git commit -m "chore: update github dependents"
48+
git push origin main
49+
50+
- name: No changes to commit
51+
if: steps.git-check.outputs.changes != 'true'
52+
run: echo "No changes to commit"

tools/fetch-github-dependents.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
99

1010
// Hardcoded repositories and their packages with dependent types
1111
const repositories = {
12+
"vitejs/rolldown-vite": {
13+
"rolldown-vite": "repositories"
14+
},
1215
"rolldown/rolldown": {
1316
rolldown: "repositories",
1417
},

0 commit comments

Comments
 (0)