Skip to content

Commit f644a19

Browse files
authored
fix(ci): consolidate duplicate yaml keys in github actions workflows (#12306)
Consolidate duplicate `if:`, `needs:`, and `working-directory:` keys in YAML files to fix parsing errors that prevent workflows from running. These duplicate keys were introduced during the monorepo migration and manual cleanups, which resulted in invalid YAML that GitHub Actions fails to parse, breaking the CI.
1 parent dea24db commit f644a19

5 files changed

+10
-20
lines changed

.github/workflows/sdk-platform-java-dependency_compatibility_test.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ jobs:
6969

7070
# Set up local showcase server to run the showcase ITs
7171
- name: Parse showcase version
72-
working-directory: sdk-plaform-java/java-showcase/gapic-showcase
72+
working-directory: sdk-platform-java/java-showcase/gapic-showcase
7373
run: echo "SHOWCASE_VERSION=$(mvn help:evaluate -Dexpression=gapic-showcase.version -q -DforceStdout)" >> "$GITHUB_ENV"
74-
working-directory: sdk-platform-java
7574
- name: Install showcase server
7675
run: |
7776
sudo mkdir -p /usr/src/showcase

.github/workflows/sdk-platform-java-downstream_protobuf_compatibility_check_nightly.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ jobs:
3030
- 'sdk-platform-java/**'
3131
downstream-protobuf-test:
3232
needs: filter
33-
if: ${{ needs.filter.outputs.library == 'true' }}
3433
# This job runs if any of the three conditions match:
3534
# 1. PR is raised from Release-Please (PR comes from branch: release-please--branches-main)
3635
# 2. Job is invoked by the nightly job (scheduled event)
3736
# 3. Job is manually invoked via Github UI (workflow_dispatch event)
38-
if: github.head_ref == 'release-please--branches--main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
37+
if: needs.filter.outputs.library == 'true' && (github.head_ref == 'release-please--branches--main' || github.event_name == 'schedule' || github.event_name == 'workflow_dispatch')
3938
runs-on: ubuntu-22.04
4039
strategy:
4140
fail-fast: false

.github/workflows/sdk-platform-java-shared_dependencies.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,9 @@ jobs:
2525
- 'sdk-platform-java/**'
2626
upper-bound-check:
2727
needs: filter
28-
if: ${{ needs.filter.outputs.library == 'true' }}
28+
if: needs.filter.outputs.library == 'true' && github.repository_owner == 'googleapis'
2929
name: Shared Dependencies BOM upper-bound check
3030
runs-on: ubuntu-latest
31-
if: github.repository_owner == 'googleapis'
3231
steps:
3332
- uses: actions/checkout@v4
3433
- uses: actions/setup-java@v4

.github/workflows/sdk-platform-java-sonar.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ jobs:
2222
- 'sdk-platform-java/**'
2323
build:
2424
needs: filter
25-
if: ${{ needs.filter.outputs.library == 'true' }}
25+
if: needs.filter.outputs.library == 'true' && (github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request')
2626
name: Build
27-
if: github.event.pull_request.head.repo.full_name == github.repository || github.event_name != 'pull_request'
2827
runs-on: ubuntu-22.04
2928
steps:
3029
- uses: actions/checkout@v3

.github/workflows/sdk-platform-java-verify_library_generation.yaml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,9 @@ jobs:
5555
head_repo_name: ${{ github.event.pull_request.head.repo.full_name }}
5656
base_repo: ${{ github.repository }}
5757
library-generation-unit-tests:
58-
needs: filter
59-
if: ${{ needs.filter.outputs.library == 'true' }}
58+
needs: [filter, should-run-library-generation-tests]
59+
if: needs.filter.outputs.library == 'true' && needs.should-run-library-generation-tests.outputs.should_run == 'true'
6060
runs-on: ubuntu-22.04
61-
needs: should-run-library-generation-tests
62-
if: needs.should-run-library-generation-tests.outputs.should_run == 'true'
6361
steps:
6462
- uses: actions/checkout@v4
6563
- uses: actions/setup-python@v5
@@ -85,11 +83,9 @@ jobs:
8583
set -x
8684
python -m unittest discover -s hermetic_build -p "*unit_tests.py"
8785
library-generation-lint-shell:
88-
needs: filter
89-
if: ${{ needs.filter.outputs.library == 'true' }}
86+
needs: [filter, should-run-library-generation-tests]
87+
if: needs.filter.outputs.library == 'true' && needs.should-run-library-generation-tests.outputs.should_run == 'true'
9088
runs-on: ubuntu-22.04
91-
needs: should-run-library-generation-tests
92-
if: needs.should-run-library-generation-tests.outputs.should_run == 'true'
9389
steps:
9490
- uses: actions/checkout@v4
9591
- name: Run ShellCheck
@@ -101,11 +97,9 @@ jobs:
10197
ignore_paths:
10298
.kokoro
10399
library-generation-lint-python:
104-
needs: filter
105-
if: ${{ needs.filter.outputs.library == 'true' }}
100+
needs: [filter, should-run-library-generation-tests]
101+
if: needs.filter.outputs.library == 'true' && needs.should-run-library-generation-tests.outputs.should_run == 'true'
106102
runs-on: ubuntu-22.04
107-
needs: should-run-library-generation-tests
108-
if: needs.should-run-library-generation-tests.outputs.should_run == 'true'
109103
steps:
110104
- uses: actions/checkout@v4
111105
- uses: actions/setup-python@v5

0 commit comments

Comments
 (0)