Skip to content

Commit 34b3712

Browse files
committed
fix(ci): trigger required checks on automated PRs
Pushes made with GITHUB_TOKEN don't trigger other workflows, leaving required CI and enterprise audit checks stuck at "Waiting for workflow to run." Close/reopen the PR after creation to generate a pull_request.reopened event that triggers all required checks. Also removes the redundant validate job from generate.yml since CI now runs properly via the PR event.
1 parent 9e46471 commit 34b3712

File tree

2 files changed

+29
-33
lines changed

2 files changed

+29
-33
lines changed

.github/workflows/generate.yml

Lines changed: 14 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -108,38 +108,19 @@ jobs:
108108
echo "PR #$existing_pr already exists, skipping creation"
109109
fi
110110
111-
- uses: SocketDev/socket-registry/.github/actions/cleanup-git-signing@6147a08ccc20fcb1f690dcc4650ec745776b3345 # main
112-
if: always()
113-
114-
validate:
115-
name: Validate generated SDK
116-
needs: fetch_and_update
117-
if: needs.fetch_and_update.outputs.has_changes == 'true'
118-
runs-on: ubuntu-latest
119-
permissions:
120-
contents: read
121-
outputs:
122-
has_changes: ${{ steps.check.outputs.has_changes }}
123-
steps:
124-
- uses: SocketDev/socket-registry/.github/actions/setup-and-install@6147a08ccc20fcb1f690dcc4650ec745776b3345 # main
125-
with:
126-
checkout-ref: automated/open-api
127-
128-
- name: Build SDK
129-
run: pnpm run build
130-
131-
- name: Type check
132-
run: pnpm run check
133-
134-
- name: Lint
135-
run: pnpm run lint --all
136-
137-
- name: Test
138-
run: pnpm run test --all
139-
140-
- name: Check for API breaking changes
111+
# Pushes made with GITHUB_TOKEN don't trigger other workflows.
112+
# Close/reopen the PR to generate a pull_request.reopened event,
113+
# which triggers required CI and enterprise audit workflows.
114+
- name: Trigger CI checks
115+
if: steps.check.outputs.has_changes == 'true'
116+
env:
117+
GH_TOKEN: ${{ github.token }}
141118
run: |
142-
if git diff origin/main...HEAD --name-only | grep -q 'types/api.d.ts'; then
143-
echo "⚠️ API types have changed. Please review for breaking changes."
144-
git diff origin/main...HEAD types/api.d.ts | head -100
119+
pr_number=$(gh pr list --head automated/open-api --json number --jq '.[0].number')
120+
if [ -n "$pr_number" ]; then
121+
gh pr close "$pr_number"
122+
gh pr reopen "$pr_number"
145123
fi
124+
125+
- uses: SocketDev/socket-registry/.github/actions/cleanup-git-signing@6147a08ccc20fcb1f690dcc4650ec745776b3345 # main
126+
if: always()

.github/workflows/weekly-update.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,21 @@ jobs:
268268
--head "$BRANCH_NAME" \
269269
--base main
270270
271+
# Pushes made with GITHUB_TOKEN don't trigger other workflows.
272+
# Close/reopen the PR to generate a pull_request.reopened event,
273+
# which triggers required CI and enterprise audit workflows.
274+
- name: Trigger CI checks
275+
if: steps.final.outputs.success == 'true' && steps.validate.outputs.valid == 'true' && steps.changes.outputs.has-changes == 'true'
276+
env:
277+
GH_TOKEN: ${{ github.token }}
278+
BRANCH_NAME: ${{ steps.branch.outputs.branch }}
279+
run: |
280+
pr_number=$(gh pr list --head "$BRANCH_NAME" --json number --jq '.[0].number')
281+
if [ -n "$pr_number" ]; then
282+
gh pr close "$pr_number"
283+
gh pr reopen "$pr_number"
284+
fi
285+
271286
- name: Add job summary
272287
if: steps.final.outputs.success == 'true' && steps.validate.outputs.valid == 'true' && steps.changes.outputs.has-changes == 'true'
273288
env:

0 commit comments

Comments
 (0)