-
Notifications
You must be signed in to change notification settings - Fork 7.6k
fix(ci): unblock docs-only PRs from required check deadlock #2641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,22 +2,36 @@ name: Test | |
|
|
||
| on: | ||
| pull_request: | ||
| paths-ignore: | ||
| - '**/*.md' | ||
| - 'docs/**' | ||
| - 'src-tauri/**' | ||
| - 'CHANGELOG.md' | ||
| - 'LICENSE' | ||
| - '.github/workflows/build-desktop.yml' | ||
| - '.github/workflows/docker-publish.yml' | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| changes: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| pull-requests: read | ||
| outputs: | ||
| code: ${{ steps.diff.outputs.code }} | ||
| steps: | ||
| - id: diff | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| if [ "${{ github.event_name }}" = "push" ]; then | ||
| echo "code=true" >> "$GITHUB_OUTPUT" | ||
| exit 0 | ||
| fi | ||
| FILES=$(gh api "repos/${{ github.repository }}/pulls/${{ github.event.number }}/files" \ | ||
| --paginate --jq '.[].filename') | ||
| CODE=$(echo "$FILES" | grep -vcE '\.md$|^docs/|^src-tauri/|^CHANGELOG\.md$|^LICENSE$|\.github/workflows/(build-desktop|docker-publish)\.yml$' || echo 0) | ||
| echo "code=$( [ "$CODE" -gt 0 ] && echo true || echo false )" >> "$GITHUB_OUTPUT" | ||
|
Comment on lines
+23
to
+30
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
- id: diff
env:
GH_TOKEN: ${{ github.token }}
EVENT_NAME: ${{ github.event_name }}
GH_REPO: ${{ github.repository }}
PR_NUMBER: ${{ github.event.number }}
run: |
if [ "$EVENT_NAME" = "push" ]; then
echo "code=true" >> "$GITHUB_OUTPUT"
exit 0
fi
FILES=$(gh api "repos/$GH_REPO/pulls/$PR_NUMBER/files" \
--paginate --jq '.[].filename')
CODE=$(echo "$FILES" | grep -vcE '\.md$|^docs/|^src-tauri/|^CHANGELOG\.md$|^LICENSE$|\.github/workflows/(build-desktop|docker-publish)\.yml$' || echo 0)
echo "code=$( [ "$CODE" -gt 0 ] && echo true || echo false )" >> "$GITHUB_OUTPUT"The same pattern appears in |
||
| unit: | ||
| needs: changes | ||
| if: needs.changes.outputs.code == 'true' | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changesfailure silently skips required checksIf the
changesjob fails (e.g. transientgh apirate-limit, network error, or ajqparse error), GitHub marks the downstreamunit/typecheck/biomejobs asskippedbecause theirneeds:dependency did not succeed. Thedeploy-gatethen seesunit=skippedandtypecheck=skipped, treats both as passing, and posts asuccessgate status — effectively letting a broken code PR through without any test or type coverage.Consider adding an explicit fallback that sets
code=trueon any API failure so the downstream jobs run rather than skip:The same applies to the identical
changesjobs inlint-code.ymlandtypecheck.yml.