Skip to content

Commit 5efbb46

Browse files
authored
chore: always run units jobs with step-level skips (#13326)
### Description This PR solves the issue where required checks `units (11)`, `units (17)`, `units (21)`, `units (25)`, and `units (8)` get stuck in a pending "stuck forever" state on GitHub. For example, https://screenshot.googleplex.com/9bpNwWP7jParbuM ### Root Cause The `units` and `units-8-runtime` jobs in `.github/workflows/ci.yaml` are conditionally skipped using job-level `if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}`. Because the entire job is skipped at the job-level, the matrix versions are not expanded, and status checks like `units (11)` are never reported to GitHub. When these checks are configured directly as required status checks in branch protection rules, PRs that skip the jobs (e.g., workflow-only PRs) are stuck forever. ### Solution We removed the job-level `if: runnable == true` conditional from both `units` and `units-8-runtime` jobs so they always start. Instead, we applied the `if: runnable == true` check to every individual step inside these jobs. When a PR doesn't need to run these checks: 1. The jobs will still start and run. 2. All steps will skip instantly. 3. The jobs will finish successfully in 1–2 seconds, reporting success and satisfying GitHub's required status checks.
1 parent 98d8e69 commit 5efbb46

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,62 +56,71 @@ jobs:
5656
units:
5757
runs-on: ubuntu-latest
5858
needs: bulk-filter
59-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
6059
strategy:
6160
fail-fast: false
6261
matrix:
6362
java: [11, 17, 21, 25]
6463
steps:
6564
- name: Get current week within the year
6665
id: date
66+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
6767
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
6868
- uses: actions/checkout@v4
69+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
6970
- uses: actions/setup-java@v4
71+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
7072
with:
7173
distribution: temurin
7274
java-version: ${{matrix.java}}
7375
- run: java -version
76+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
7477
- uses: actions/cache@v4
7578
id: mvn-cache
79+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
7680
with:
7781
path: ~/.m2/repository
7882
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }}
7983
- run: .kokoro/build.sh
80-
if: ${{ needs.bulk-filter.outputs.src == 'true' || needs.bulk-filter.outputs.ci == 'true' }}
84+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' && (needs.bulk-filter.outputs.src == 'true' || needs.bulk-filter.outputs.ci == 'true') }}
8185
env:
8286
JOB_TYPE: test
8387
JOB_NAME: units-${{matrix.java}}
8488
units-8-runtime:
8589
runs-on: ubuntu-latest
8690
needs: bulk-filter
87-
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
8891
name: "units (8)"
8992
steps:
9093
- name: Get current week within the year
9194
id: date
95+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
9296
run: echo "::set-output name=week_of_year::$(date +'%W' --utc)"
9397
- uses: actions/checkout@v4
98+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
9499
- uses: actions/setup-java@v4
100+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
95101
with:
96102
java-version: 8
97103
distribution: temurin
98104
- name: "Set jvm system property environment variable for surefire plugin (unit tests)"
99105
# Maven surefire plugin (unit tests) allows us to specify JVM to run the tests.
100106
# https://maven.apache.org/surefire/maven-surefire-plugin/test-mojo.html#jvm
107+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
101108
run: echo "SUREFIRE_JVM_OPT=-Djvm=${JAVA_HOME}/bin/java" >> $GITHUB_ENV
102109
shell: bash
103110
- uses: actions/setup-java@v4
111+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
104112
with:
105113
java-version: 11
106114
distribution: temurin
107115
cache: maven
108116
- uses: actions/cache@v4
109117
id: mvn-cache
118+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' }}
110119
with:
111120
path: ~/.m2/repository
112121
key: ${{ runner.os }}-maven-unified-${{ steps.date.outputs.week_of_year }}
113122
- run: .kokoro/build.sh
114-
if: ${{ needs.bulk-filter.outputs.src == 'true' || needs.bulk-filter.outputs.ci == 'true' }}
123+
if: ${{ needs.bulk-filter.outputs.runnable == 'true' && (needs.bulk-filter.outputs.src == 'true' || needs.bulk-filter.outputs.ci == 'true') }}
115124
shell: bash
116125
env:
117126
JOB_TYPE: test

0 commit comments

Comments
 (0)