Skip to content

Commit 04d0eb6

Browse files
chore: Refactor Github Action per b/485167538 (#13866)
This is a http://go/LSC run by http://go/ghss to automatically refactor your Github Actions per http://b/485167538. This is a PR to help you upgrade to the latest standards in Github Actions. Please merge this PR to accept the changes. NOTE: if you do not accept this PR, it may be force merged by the GHSS team. See http://b/485167538 for more details. Co-authored-by: Ben Knutson <benknutson@google.com>
1 parent 1373016 commit 04d0eb6

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

.github/workflows/apidiff.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,15 @@ jobs:
6363
- name: Create baseline
6464
id: baseline
6565
run: |
66-
export CHANGED=${{ matrix.changed }}
66+
export CHANGED=${MATRIX_CHANGED}
6767
echo pkg="${CHANGED//\//_}_pkg.main" >> $GITHUB_OUTPUT
68+
env:
69+
MATRIX_CHANGED: ${{ matrix.changed }}
6870
- name: Create Go package baseline
69-
run: cd ${{ matrix.changed }} && apidiff -m -w ${{ steps.baseline.outputs.pkg }} .
71+
run: cd ${MATRIX_CHANGED} && apidiff -m -w ${STEPS_BASELINE_OUTPUTS_PKG} .
72+
env:
73+
MATRIX_CHANGED: ${{ matrix.changed }}
74+
STEPS_BASELINE_OUTPUTS_PKG: ${{ steps.baseline.outputs.pkg }}
7075
- name: Upload baseline package data
7176
uses: actions/upload-artifact@v6
7277
with:
@@ -88,9 +93,11 @@ jobs:
8893
# as it is likely a new method added to the gRPC client stub interface, which is non-breaking.
8994
env:
9095
PR_HEAD_REF: ${{ github.event.pull_request.head.ref }}
96+
MATRIX_CHANGED: ${{ matrix.changed }}
97+
STEPS_BASELINE_OUTPUTS_PKG: ${{ steps.baseline.outputs.pkg }}
9198
run: |
92-
cd ${{ matrix.changed }}
93-
apidiff -m -incompatible ${{ steps.baseline.outputs.pkg }} . > diff.txt
99+
cd ${MATRIX_CHANGED}
100+
apidiff -m -incompatible ${STEPS_BASELINE_OUTPUTS_PKG} . > diff.txt
94101
if [[ "$PR_HEAD_REF" == librarian-* ]]; then
95102
sed -i '/: added/d' ./diff.txt
96103
fi
@@ -110,11 +117,13 @@ jobs:
110117
id: ga_check # Add an ID to this step to check its outcome later.
111118
if: steps.detect.outputs.breaking_change_found == 'true'
112119
run: |
113-
if [[ "${{ matrix.changed }}" =~ apiv[0-9]+$ ]]; then
114-
echo "Error: Breaking change detected in GA API: ${{ matrix.changed }}"
120+
if [[ "${MATRIX_CHANGED}" =~ apiv[0-9]+$ ]]; then
121+
echo "Error: Breaking change detected in GA API: ${MATRIX_CHANGED}"
115122
exit 1
116123
fi
117124
echo "Breaking change in non-GA API, proceeding."
125+
env:
126+
MATRIX_CHANGED: ${{ matrix.changed }}
118127
# Step 3: Add a "breaking change" label.
119128
# This step runs if a breaking change was found, regardless of whether the
120129
# API is GA or not. This ensures that all breaking changes are labeled for

.github/workflows/third_party_check.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ jobs:
4848
- uses: actions/checkout@v6
4949
- run: |
5050
cd internal/actions
51-
go run ./internal/actions/cmd/thirdpartycheck -q --dir=${{ github.workspace }} -mod ${{ matrix.mods }}/go.mod
51+
go run ./internal/actions/cmd/thirdpartycheck -q --dir=${{ github.workspace }} -mod ${MATRIX_MODS}/go.mod
52+
env:
53+
MATRIX_MODS: ${{ matrix.mods }}

0 commit comments

Comments
 (0)