Skip to content

Commit 30fd3c8

Browse files
benknutson-googleanaik91
authored andcommitted
fix: Refactor Github Action per b/485167538
Change-Id: I71c99b382aa665d298db6e22035fd4a470b03c51
1 parent cdb9abb commit 30fd3c8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

.github/workflows/tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ jobs:
9898
run: |
9999
if [[ "${{ github.event_name }}" == "pull_request_target" ]]; then
100100
echo "tag=pr-${{ github.event.number }}" >> "$GITHUB_OUTPUT"
101-
elif [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
101+
elif [[ "${GITHUB_REF}" == "refs/heads/main" ]]; then
102102
echo "tag=latest" >> "$GITHUB_OUTPUT"
103103
else
104104
# For feature branches, etc.
105-
echo "tag=${{ github.ref_name }}" | sed 's/\//-/g' >> "$GITHUB_OUTPUT"
105+
echo "tag=${GITHUB_REF_NAME}" | sed 's/\//-/g' >> "$GITHUB_OUTPUT"
106106
fi
107107
108108
- name: Build and push Docker image
@@ -153,10 +153,13 @@ jobs:
153153
docker run \
154154
-v "${{ github.workspace }}/input.properties:/app/input.properties" \
155155
-v "${{ github.workspace }}/output:/app/target" \
156-
-e "SOURCE_AUTH_TOKEN=${{ steps.get_token.outputs.access_token }}" \
157-
"${{ env.IMAGE_NAME }}:${{ needs.build-and-push.outputs.image_tag }}" \
156+
-e "SOURCE_AUTH_TOKEN=${STEPS_GET_TOKEN_OUTPUTS_ACCESS_TOKEN}" \
157+
"${IMAGE_NAME}:${NEEDS_BUILD_AND_PUSH_OUTPUTS_IMAGE_TAG}" \
158158
--skip-target-validation \
159159
--resources all
160+
env:
161+
STEPS_GET_TOKEN_OUTPUTS_ACCESS_TOKEN: ${{ steps.get_token.outputs.access_token }}
162+
NEEDS_BUILD_AND_PUSH_OUTPUTS_IMAGE_TAG: ${{ needs.build-and-push.outputs.image_tag }}
160163

161164
- name: Upload latest assement results
162165
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)