Skip to content

debugging 403 error

debugging 403 error #3

name: Generate Subdirectory List
on:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
persist-credentials: true
ref: main # Make sure to track the actual branch
- name: Generate subdirectories.json
run: |
echo "[" > subdirectories.json
for dir in */ ; do
if [[ "$dir" != "assets/" && "$dir" != ".github/" ]]; then
echo " \"${dir%/}\"," >> subdirectories.json
fi
done
sed -i '$ s/,$//' subdirectories.json
echo "]" >> subdirectories.json
- name: Commit and push
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add subdirectories.json
git commit -m "Update subdirectories list" || echo "No changes"
git push origin main # Explicitly push to the main branch