Skip to content

Commit 2deea86

Browse files
authored
Add GitHub Actions workflow to generate links.json
1 parent bcf6ad0 commit 2deea86

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Generate Links JSON
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
generate-links:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: List folders and create JSON
18+
run: |
19+
# List directories, exclude .github, and create JSON array
20+
folders=$(ls -d */ 2>/dev/null | sed 's|/$||' | grep -v '^\.github$' || true)
21+
if [ -n "$folders" ]; then
22+
json_array=$(echo "$folders" | jq -R . | jq -s .)
23+
echo "$json_array" > links.json
24+
else
25+
echo "[]" > links.json
26+
fi
27+
28+
- name: Commit and push changes
29+
run: |
30+
git config --local user.email "action@github.com"
31+
git config --local user.name "GitHub Action"
32+
git add links.json
33+
if git diff --staged --quiet; then
34+
echo "No changes to commit"
35+
else
36+
git commit -m "[ci skip] Update links.json with current folders"
37+
git push
38+
fi

0 commit comments

Comments
 (0)