Skip to content

Commit d52ae4e

Browse files
committed
fix(ci): fix generate SDK workflow GPG signing and push auth
- Use setup-and-install action instead of manual checkout with persist-credentials: false - Push via git push origin instead of manual URL construction - Only run cleanup-git-signing when setup-git-signing actually ran - Use checkout-ref for validate job
1 parent d07c1e6 commit d52ae4e

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

.github/workflows/generate.yml

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,17 @@ jobs:
4545
echo "Sleeping for $delay seconds..."
4646
sleep $delay
4747
48-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
49-
with:
50-
persist-credentials: false
51-
token: ${{ secrets.GITHUB_TOKEN }}
52-
5348
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@da519693b701861bc0f9690a30f50af1a1dcd49c # main
5449

50+
- name: Configure push credentials
51+
env:
52+
GH_TOKEN: ${{ github.token }}
53+
run: git remote set-url origin "https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }}.git"
54+
55+
- uses: SocketDev/socket-registry/.github/actions/setup-git-signing@da519693b701861bc0f9690a30f50af1a1dcd49c # main
56+
with:
57+
gpg-private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
58+
5559
- name: Generate SDK
5660
# Fetches OpenAPI, generates types/api.d.ts and src/types-strict.ts
5761
run: pnpm run generate-sdk
@@ -65,26 +69,18 @@ jobs:
6569
echo "has_changes=false" >> $GITHUB_OUTPUT
6670
fi
6771
68-
- uses: SocketDev/socket-registry/.github/actions/setup-git-signing@da519693b701861bc0f9690a30f50af1a1dcd49c # main
69-
if: steps.check.outputs.has_changes == 'true'
70-
with:
71-
gpg-private-key: ${{ secrets.BOT_GPG_PRIVATE_KEY }}
72-
7372
- name: Commit and push changes
7473
if: steps.check.outputs.has_changes == 'true'
75-
env:
76-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
77-
REPO: ${{ github.repository }}
7874
run: |
7975
git checkout -b automated/open-api
8076
git add .
8177
git commit -m "fix(openapi): sync with openapi definition"
82-
git push "https://x-access-token:${GH_TOKEN}@github.com/${REPO}.git" automated/open-api -fu
78+
git push origin automated/open-api -fu
8379
8480
- name: Create Pull Request
8581
if: steps.check.outputs.has_changes == 'true'
8682
env:
87-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
83+
GH_TOKEN: ${{ github.token }}
8884
run: |
8985
# Check if PR already exists
9086
existing_pr=$(gh pr list --head automated/open-api --json number --jq '.[0].number' || echo "")
@@ -94,7 +90,7 @@ jobs:
9490
--head automated/open-api \
9591
--base main \
9692
--title "Sync with OpenAPI definition" \
97-
--body "## 🔄 OpenAPI Sync
93+
--body "## OpenAPI Sync
9894
9995
The OpenAPI definition in the API has been updated. This PR automatically:
10096
- Downloads the latest OpenAPI specification
@@ -105,7 +101,7 @@ jobs:
105101
### What's Changed
106102
See the file changes below for specific updates to the API types, strict types, and methods.
107103
108-
⚠️ **Please review carefully for any breaking changes in the API.**" \
104+
**Please review carefully for any breaking changes in the API.**" \
109105
--label "dependencies" \
110106
--label "automated"
111107
else
@@ -125,12 +121,9 @@ jobs:
125121
outputs:
126122
has_changes: ${{ steps.check.outputs.has_changes }}
127123
steps:
128-
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
129-
with:
130-
persist-credentials: false
131-
ref: automated/open-api
132-
133124
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@da519693b701861bc0f9690a30f50af1a1dcd49c # main
125+
with:
126+
checkout-ref: automated/open-api
134127

135128
- name: Build SDK
136129
run: pnpm run build

0 commit comments

Comments
 (0)