66 - ' specs/**'
77
88permissions :
9- contents : write # This is correct and grants the necessary permissions.
9+ contents : write
1010
1111jobs :
1212 lint-and-bundle :
@@ -15,20 +15,40 @@ jobs:
1515 - name : Checkout repository
1616 uses : actions/checkout@v4
1717 with :
18- fetch-depth : 0
1918 ref : ${{ github.ref }}
2019
2120 - name : Set up Redocly CLI
2221 run : npm install -g @redocly/cli
2322
2423 - name : Run specs bundling script
24+ working-directory : ${{ github.workspace }}
2525 run : |
26- chmod +x scripts/generate-api-docs.sh
27- scripts/generate-api-docs.sh
26+ chmod +x scripts/generate-api-docs.sh
27+ ./ scripts/generate-api-docs.sh
2828
29- - name : Commit and push changes
30- uses : ad-m/github-push-action@master
31- with :
32- github_token : ${{ secrets.GITHUB_TOKEN }} # Use the correct, built-in secret
33- branch : ${{ github.ref }}
34- message : " docs: generate API documentation"
29+ - name : Commit and push documentation
30+ run : |
31+ git config --local user.email "[email protected] " 32+ git config --local user.name "GitHub Action"
33+
34+ # Fetch the gh-pages-test branch
35+ git fetch origin gh-pages-test
36+
37+ # Create a separate worktree for the branch
38+ git worktree add /tmp/gh-pages-test gh-pages-test
39+
40+ # Copy generated docs into the worktree
41+ mkdir -p /tmp/gh-pages-test/docs/api-docs
42+ cp -r docs/api-docs/* /tmp/gh-pages-test/docs/api-docs/ || true
43+
44+ cd /tmp/gh-pages-test
45+
46+ git add .
47+ if git diff --staged --quiet; then
48+ echo "✅ No changes to commit"
49+ else
50+ git commit -m "📄 Update API documentation"
51+ git push origin gh-pages-test
52+ echo "🚀 Documentation pushed to gh-pages-test branch!"
53+ fi
54+
0 commit comments