Skip to content

feat: git push job in action file #12

feat: git push job in action file

feat: git push job in action file #12

name: API Specs Merger
on:
push:
paths:
- 'specs/**'
permissions:
contents: write
jobs:
lint-and-bundle:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
- name: Set up Redocly CLI
run: npm install -g @redocly/cli
- name: Run specs bundling script
working-directory: ${{ github.workspace }}
run: |
chmod +x scripts/generate-api-docs.sh
./scripts/generate-api-docs.sh
- name: Commit and push documentation
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
# Fetch the target branch so Git knows about it
git fetch origin gh-pages-test
# Switch to it
git checkout gh-pages-test
# Copy generated docs
git add docs/api-docs/ specs/swagger/openapi.html specs/swagger/openapi.yaml
if git diff --staged --quiet; then
echo "✅ No changes to commit"
else
git commit -m "📄 Update API documentation"
git push origin gh-pages-test
echo "🚀 Documentation pushed to gh-pages-test branch!"
fi