-
Notifications
You must be signed in to change notification settings - Fork 569
57 lines (46 loc) · 1.47 KB
/
api-spec-merger.yaml
File metadata and controls
57 lines (46 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
name: API Specs Merger
on:
push:
branches:
- main
paths:
- 'specs/**'
permissions:
contents: write
jobs:
lint-bundle-host:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
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
env:
GITHUB_TOKEN: ${{ secrets.GH_SYSTEMSDT_TOKEN }}
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
# Fetch the gh-pages branch
git fetch origin gh-pages
# Create a separate worktree for the branch
git worktree add /tmp/gh-pages gh-pages
# Copy generated docs into the worktree
mkdir -p /tmp/gh-pages/docs/api-docs
cp -r docs/api-docs/* /tmp/gh-pages/docs/api-docs/ || true
cd /tmp/gh-pages
git add .
if git diff --staged --quiet; then
echo "✅ No changes to commit"
else
git commit -m "📄 Update API documentation"
git push origin gh-pages
echo "🚀 Documentation pushed to gh-pages branch!"
fi