Skip to content

Add write permissions to dynamic links workflow #2

Add write permissions to dynamic links workflow

Add write permissions to dynamic links workflow #2

Workflow file for this run

name: Generate Links JSON

Check failure on line 1 in .github/workflows/dynamic-links.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/dynamic-links.yml

Invalid workflow file

(Line: 10, Col: 3): Unexpected value 'write'
on:
push:
branches:
- main
workflow_dispatch:
permissions:
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