Skip to content

Commit

Permalink
Remove expression syntax from workflow if conditions (iree-org#13457)
Browse files Browse the repository at this point in the history
This is optional, but also including it can result in some really weird
behavior. These conditions both run the step in question, for instance:

```
if: ${{ needs.setup.outputs.write-caches }} == 1
if: ${{ needs.does-not-exist }} == 1
```

My guess is that the issue is with including the expression syntax
around only the variable and not the literal, though it seems like that
should really just be a hard error if it's invalid syntax...

This fixes the conditional for only attempting GCP auth if running in a
context that has secrets (not a fork).
  • Loading branch information
GMNGeoffrey authored and NatashaKnk committed Jul 6, 2023
1 parent e6e4688 commit ab0d0bc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
git submodule update --init --jobs 8 --depth 1
- id: "gcp-auth"
name: "Authenticating to Google Cloud"
if: ${{ needs.setup.outputs.write-caches }} == 1
if: needs.setup.outputs.write-caches == 1
uses: "google-github-actions/auth@v1"
with:
token_format: "access_token"
Expand Down Expand Up @@ -177,7 +177,7 @@ jobs:
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0
- id: "gcp-auth"
name: "Authenticating to Google Cloud"
if: ${{ needs.setup.outputs.write-caches }} == 1
if: needs.setup.outputs.write-caches == 1
uses: "google-github-actions/auth@v1"
with:
token_format: "access_token"
Expand Down Expand Up @@ -894,7 +894,7 @@ jobs:
"${DOCKER_IMAGE}" \
"${BUILD_SCRIPT}"
- name: "Test cross-compiling target"
if: ${{ matrix.target.test_script }}
if: matrix.target.test_script
run: |
./build_tools/github_actions/docker_run.sh \
--env "IREE_TARGET_PLATFORM=${PLATFORM}" \
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
git diff -U0 "${GITHUB_BASE_REF?}" | python3 third_party/format_diff/format_diff.py yapf -i
git diff --exit-code
- name: Instructions for fixing the above linting errors
if: ${{ failure() }}
if: failure()
run: |
printf "You can fix the lint errors above by running\n"
printf " git diff -U0 "${GITHUB_BASE_REF?}" | python3 third_party/format_diff/format_diff.py yapf -i\n"
Expand Down Expand Up @@ -167,7 +167,7 @@ jobs:
- name: Check BUILD files are not named BUILD (prefer BUILD.bazel)
run: exit $(git ls-files '**/BUILD' | wc -l)
- name: Instructions for fixing the above linting error
if: ${{ failure() }}
if: failure()
run: |
echo "failure: found files named BUILD. Please rename the following files to BUILD.bazel:"
git ls-files '**/BUILD'
2 changes: 1 addition & 1 deletion .github/workflows/run_shark_tank.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,6 @@ jobs:
run: |
gcloud storage cp "${BENCHMARK_RESULTS_DIR}/summary.html" "${GCS_UPLOAD_DIR}/"
- name: "Updating latest"
if: ${{ github.event_name != 'pull_request' }}
if: github.event_name != 'pull_request'
run: |
gcloud storage cp "${BENCHMARK_RESULTS_DIR}/summary.html" "${GCS_LATEST_DIR}/"

0 comments on commit ab0d0bc

Please sign in to comment.