-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Only run cargo check when rust code is changed
#7760
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
ccd803e
1f23cc3
50a51d5
906435b
fbc6582
1c7f1bc
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 |
|---|---|---|
|
|
@@ -36,6 +36,45 @@ env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true # TODO: Remove on 2026/06/02 | ||
|
|
||
| jobs: | ||
| determine_changes: | ||
| name: Determine changes | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| # Flag that is raised when any rust code is changed. | ||
| rust_code: ${{ steps.check_rust_code.outputs.changed }} | ||
| steps: | ||
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | ||
| with: | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Determine merge base | ||
| id: merge_base | ||
| run: | | ||
| sha=$(git merge-base HEAD "origin/${BASE_REF}") | ||
| echo "sha=${sha}" >> "$GITHUB_OUTPUT" | ||
| env: | ||
| BASE_REF: ${{ github.event.pull_request.base.ref || 'main' }} | ||
|
|
||
| - name: Check if there was any code related change | ||
| id: check_rust_code | ||
| run: | | ||
| if git diff --quiet "${MERGE_BASE}...HEAD" -- \ | ||
| ':Cargo.toml' \ | ||
| ':Cargo.lock' \ | ||
| ':rust-toolchain.toml' \ | ||
| ':.cargo/config.toml' \ | ||
| ':crates/**' \ | ||
| ':src/**' \ | ||
| ':.github/workflows/ci.yaml' \ | ||
| ; then | ||
| echo "changed=false" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "changed=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
| env: | ||
| MERGE_BASE: ${{ steps.merge_base.outputs.sha }} | ||
|
|
||
| rust_tests: | ||
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} | ||
| env: | ||
|
|
@@ -120,9 +159,15 @@ jobs: | |
| if: runner.os == 'Linux' | ||
|
|
||
| cargo_check: | ||
| if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip:ci') }} | ||
| name: cargo check | ||
| runs-on: ${{ matrix.os }} | ||
| needs: | ||
| - determine_changes | ||
| if: | | ||
| ( | ||
| !contains(github.event.pull_request.labels.*.name, 'skip:ci') && | ||
| needs.determine_changes.outputs.rust_code == 'true' | ||
| ) || github.ref == 'refs/heads/main' | ||
|
Comment on lines
+166
to
+170
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.
GitHub Actions implicitly wraps any job If 🛠️ Proposed fix- if: |
- (
- !contains(github.event.pull_request.labels.*.name, 'skip:ci') &&
- needs.determine_changes.outputs.rust_code == 'true'
- ) || github.ref == 'refs/heads/main'
+ if: |
+ (
+ needs.determine_changes.result == 'success' &&
+ !contains(github.event.pull_request.labels.*.name, 'skip:ci') &&
+ needs.determine_changes.outputs.rust_code == 'true'
+ ) || (
+ !failure() && !cancelled() &&
+ github.ref == 'refs/heads/main'
+ )🤖 Prompt for AI Agents |
||
| strategy: | ||
| matrix: | ||
| include: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.