File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments