Skip to content

Commit 23bf89e

Browse files
committed
create pr
1 parent ea0be9f commit 23bf89e

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

.github/workflows/sync-openapi-spec-to-docs.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,37 @@ jobs:
2020
echo "${{ secrets.DOCS_DEPLOY_KEY }}" > ~/.ssh/id_ed25519
2121
chmod 600 ~/.ssh/id_ed25519
2222
ssh-keyscan github.com >> ~/.ssh/known_hosts
23+
24+
- name: Install GitHub CLI
25+
run: sudo apt-get install -y gh
2326

2427
- name: Clone docs repo
2528
run: |
2629
git clone git@github.com:togethercomputer/mintlify-docs.git
2730
cp openapi.yaml mintlify-docs/openapi.yaml
2831
2932
- name: Commit and push update
33+
env:
34+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3035
run: |
3136
cd mintlify-docs
3237
git config user.name "github-actions[bot]"
3338
git config user.email "github-actions[bot]@users.noreply.github.com"
3439
40+
if git diff --quiet openapi.yaml; then
41+
echo "No changes to commit"
42+
exit 0
43+
fi
44+
45+
BRANCH_NAME=sync-openapi-$(date +%s)
46+
47+
git checkout -b "$BRANCH_NAME"
3548
git add openapi.yaml
36-
git commit -m "Sync OpenAPI spec from openapi-spec repo"
37-
git push origin main
49+
git commit -m "Sync OpenAPI spec from openapi-spec"
50+
git push origin "$BRANCH_NAME"
51+
52+
gh pr create \
53+
--title "Sync OpenAPI spec" \
54+
--body "This PR syncs openapi.yaml from openapi repo." \
55+
--base main \
56+
--head "$BRANCH_NAME"

0 commit comments

Comments
 (0)