Repository navigation
ci: skip builds for documentation-only changes #7650
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
base: develop
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ permissions: | |
| actions: read | ||
| contents: read | ||
| packages: read | ||
| pull-requests: read | ||
|
|
||
| concurrency: | ||
| group: | | ||
|
|
@@ -25,6 +26,7 @@ jobs: | |
| runs-on: ${{ vars.RUNNER_CHECK_SKIP || 'ubuntu-24.04-arm' }} | ||
| outputs: | ||
| skip: ${{ steps.skip-check.outputs.skip }} | ||
| run-build-tests: ${{ steps.classify-changes.outputs.run-build-tests }} | ||
| runner-amd64: ${{ steps.select-runner.outputs.runner_amd64 }} | ||
| runner-arm64: ${{ steps.select-runner.outputs.runner_arm64 }} | ||
| runner-prelint: ${{ steps.select-runner.outputs.runner_prelint }} | ||
|
|
@@ -53,6 +55,30 @@ jobs: | |
| echo "skip=false" >> $GITHUB_OUTPUT | ||
| fi | ||
|
|
||
| - name: Classify changed paths | ||
| id: classify-changes | ||
| if: ${{ steps.skip-check.outputs.skip == 'false' }} | ||
| env: | ||
| EVENT_NAME: ${{ github.event_name }} | ||
| GH_TOKEN: ${{ github.token }} | ||
| CHANGED_FILES: ${{ github.event.pull_request.changed_files }} | ||
| PR_NUMBER: ${{ github.event.pull_request.number }} | ||
| REPOSITORY: ${{ github.repository }} | ||
| run: | | ||
| # Pull requests that only touch Markdown outside src/ skip the full | ||
| # build and test matrix. Any API failure, or a PR too large for the | ||
| # files endpoint (3000-file cap), leaves the full matrix on. | ||
| RUN=true | ||
| if [[ "$EVENT_NAME" == "pull_request_target" && "${CHANGED_FILES:-3000}" -lt 3000 ]]; then | ||
| FILES="$(gh api --paginate "repos/$REPOSITORY/pulls/$PR_NUMBER/files" \ | ||
| --jq '.[] | .filename, (.previous_filename // empty)')" || FILES="" | ||
|
Comment on lines
+73
to
+74
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.
When a PR changes more than 3,000 files and a build-relevant path is outside the returned subset (for example, the returned entries are all Useful? React with 👍 / 👎.
Member
Author
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. Valid; fixed in 6b8898a. The classify step now only considers skipping when 🤖 Posted autonomously by Claude on behalf of pasta. |
||
| if [[ -n "$FILES" ]] && ! grep -qvE '\.md$' <<< "$FILES" && ! grep -qE '^src/' <<< "$FILES"; then | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| RUN=false | ||
| fi | ||
| fi | ||
| echo "Full build and test matrix: $RUN" | ||
| echo "run-build-tests=$RUN" >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Checkout code | ||
| if: ${{ steps.skip-check.outputs.skip == 'false' }} | ||
| uses: actions/checkout@v6 | ||
|
|
@@ -117,7 +143,9 @@ jobs: | |
| cache-sources: | ||
| name: Cache depends sources | ||
| needs: [check-skip] | ||
| if: ${{ needs.check-skip.outputs.skip == 'false' }} | ||
| if: | | ||
| needs.check-skip.outputs.skip == 'false' && | ||
| needs.check-skip.outputs.run-build-tests == 'true' | ||
| uses: ./.github/workflows/cache-depends-sources.yml | ||
| with: | ||
| runs-on: ${{ needs.check-skip.outputs['runner-prelint'] }} | ||
|
|
@@ -130,7 +158,9 @@ jobs: | |
| packages: write | ||
| name: Build container | ||
| needs: [check-skip] | ||
| if: ${{ needs.check-skip.outputs.skip == 'false' }} | ||
| if: | | ||
| needs.check-skip.outputs.skip == 'false' && | ||
| needs.check-skip.outputs.run-build-tests == 'true' | ||
| uses: ./.github/workflows/build-container.yml | ||
| with: | ||
| context: ./contrib/containers/ci | ||
|
|
||
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.
can the whole PR be reduced to just
?
This
classify_ci_changes.pyis over-complicatedThere 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.
Yes. Reworked in 7ab20b0 to essentially this diff: a single bash step in check-skip gating
containerandcache-sources, with the PR number and repository passed via env instead of inline expressions.classify_ci_changes.pyand its tests are gone.🤖 Posted autonomously by Codex on behalf of pasta.