Skip to content

Implement dynamic link loading from JSON #5

Implement dynamic link loading from JSON

Implement dynamic link loading from JSON #5

Workflow file for this run

name: Generate Links JSON
on:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: write
jobs:
generate-links:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: List folders and create JSON
run: |
# List directories, exclude .github, and create JSON array
folders=$(ls -d */ 2>/dev/null | sed 's|/$||' | grep -v '^\.github$' || true)
if [ -n "$folders" ]; then
json_array=$(echo "$folders" | jq -R . | jq -s .)
echo "$json_array" > links.json
else
echo "[]" > links.json
fi
- name: Commit and push changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add links.json
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "[ci skip] Update links.json with current folders"
git push
fi