Skip to content

Commit 88231b1

Browse files
Merge #6794: ci: add SKIP_ON_PUSH and SKIP_ON_PR environment variables to build workflow
7417fb9 ci: simplify skip logic to only affect container jobs (pasta) 6d89784 ci: add SKIP_ON_PUSH and SKIP_ON_PR environment variables to build workflow (pasta) Pull request description: ## Issue being fixed or feature implemented In DashCoreAutoGuix/dash, it's a pain to see which PRs have successfully CI, because the PR CI cancels the push CI, and GitHub UI interprets a cancel as a fail. This will allow me to configure the CI to only run the CI for the push commit, allow the CI status on the PR page to accurately reflect the true status. ## What was done? Add support for skipping CI builds based on environment variables: - SKIP_ON_PUSH: Skip all builds when set on push events - SKIP_ON_PR: Skip all builds when set on pull request events This provides a quick way to disable CI runs without modifying workflow files directly, useful for maintenance periods or resource management. ## How Has This Been Tested? See PastaPastaPasta#37 for this working in my fork. ## Breaking Changes None ## Checklist: _Go over all the following points, and put an `x` in all the boxes that apply._ - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ ACKs for top commit: UdjinM6: utACK 7417fb9 Tree-SHA512: feef92af6bf43977e38f78370201cd21e1c4193c622e8c2b0685cf4f7c7c274b020c2cc9ff7a93f311a25676a652d3a94e5cf17ea4341b1278aa35d6bbc7ec07
2 parents 2ac371d + 7417fb9 commit 88231b1

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

.github/workflows/build.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,29 @@ concurrency:
1818
cancel-in-progress: ${{ github.ref_type != 'tag' }}
1919

2020
jobs:
21+
check-skip:
22+
name: Check skip conditions
23+
runs-on: ubuntu-latest
24+
outputs:
25+
skip: ${{ steps.skip-check.outputs.skip }}
26+
steps:
27+
- name: Check skip environment variables
28+
id: skip-check
29+
run: |
30+
if [[ "${{ github.event_name }}" == "push" && "${{ vars.SKIP_ON_PUSH }}" != "" ]]; then
31+
echo "Skipping build on push due to SKIP_ON_PUSH environment variable"
32+
echo "skip=true" >> $GITHUB_OUTPUT
33+
elif [[ "${{ github.event_name }}" == "pull_request_target" && "${{ vars.SKIP_ON_PR }}" != "" ]]; then
34+
echo "Skipping build on pull request due to SKIP_ON_PR environment variable"
35+
echo "skip=true" >> $GITHUB_OUTPUT
36+
else
37+
echo "skip=false" >> $GITHUB_OUTPUT
38+
fi
39+
2140
container:
2241
name: Build container
42+
needs: [check-skip]
43+
if: ${{ needs.check-skip.outputs.skip == 'false' }}
2344
uses: ./.github/workflows/build-container.yml
2445
with:
2546
context: ./contrib/containers/ci
@@ -28,6 +49,8 @@ jobs:
2849

2950
container-slim:
3051
name: Build slim container
52+
needs: [check-skip]
53+
if: ${{ needs.check-skip.outputs.skip == 'false' }}
3154
uses: ./.github/workflows/build-container.yml
3255
with:
3356
context: ./contrib/containers/ci

0 commit comments

Comments
 (0)