File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Sync OpenAPI to docs repo
2+ permissions :
3+ contents : read
4+ pull-requests : write
5+
6+ on :
7+ push :
8+ branches : [main]
9+ paths :
10+ - ' openapi.yaml'
11+
12+ jobs :
13+ sync :
14+ runs-on : ubuntu-latest
15+
16+ steps :
17+ - name : Checkout openapi-spec
18+ uses : actions/checkout@v4
19+
20+ - name : Set up SSH for deploy key
21+ run : |
22+ mkdir -p ~/.ssh
23+ echo "${{ secrets.DOCS_DEPLOY_KEY }}" > ~/.ssh/id_ed25519
24+ chmod 600 ~/.ssh/id_ed25519
25+ ssh-keyscan github.com >> ~/.ssh/known_hosts
26+
27+ - name : Install GitHub CLI
28+ run : sudo apt-get install -y gh
29+
30+ - name : Clone docs repo
31+ run : |
32+ git clone git@github.com:togethercomputer/mintlify-docs.git
33+ cp openapi.yaml mintlify-docs/openapi.yaml
34+
35+ - name : Commit and push update
36+ env :
37+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
38+ run : |
39+ cd mintlify-docs
40+ git config user.name "github-actions[bot]"
41+ git config user.email "github-actions[bot]@users.noreply.github.com"
42+
43+ if git diff --quiet openapi.yaml; then
44+ echo "No changes to commit"
45+ exit 0
46+ fi
47+
48+ BRANCH_NAME=sync-openapi-$(date +%s)
49+
50+ git checkout -b "$BRANCH_NAME"
51+ git add openapi.yaml
52+ git commit -m "Sync OpenAPI spec from openapi-spec"
53+ git push origin "$BRANCH_NAME"
54+
55+ gh pr create \
56+ --title "Sync OpenAPI spec" \
57+ --body "This PR syncs openapi.yaml from openapi repo." \
58+ --base main \
59+ --head "$BRANCH_NAME"
You can’t perform that action at this time.
0 commit comments