Skip to content

Commit d2c32bb

Browse files
authored
fix(ci): Skip e2e metrics steps when the auth token is not available (#4233)
1 parent 5f40a37 commit d2c32bb

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

.github/workflows/e2e.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ env:
2020
jobs:
2121
diff_check:
2222
uses: ./.github/workflows/skip-ci.yml
23+
auth_token_check:
24+
uses: ./.github/workflows/skip-ci-noauth.yml
25+
secrets: inherit
2326

2427
metrics:
2528
runs-on: ${{ matrix.runs-on }}
26-
needs: [diff_check]
27-
if: ${{ needs.diff_check.outputs.skip_ci != 'true' && env.SENTRY_AUTH_TOKEN != null }}
29+
needs: [diff_check, auth_token_check]
30+
if: ${{ needs.diff_check.outputs.skip_ci != 'true' && needs.auth_token_check.outputs.skip_ci != 'true' }}
2831
env:
2932
SENTRY_DISABLE_AUTO_UPLOAD: 'true'
3033
strategy:

.github/workflows/skip-ci-noauth.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Skip CI when the auth token is not accessible
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
skip_ci:
7+
description: "Value 'true' if the CI cannot access the SENTRY_AUTH_TOKEN, otherwise, not defined."
8+
value: ${{ jobs.auth_token_check.outputs.skip_ci }}
9+
10+
jobs:
11+
auth_token_check:
12+
runs-on: ubuntu-latest
13+
env:
14+
sentry_auth_token: ${{ secrets.SENTRY_AUTH_TOKEN }}
15+
outputs:
16+
skip_ci: ${{ steps.set_skip_ci.outputs.skip_ci }}
17+
steps:
18+
- id: set_skip_ci
19+
if: ${{ env.sentry_auth_token == '' }}
20+
run: |
21+
echo "skip_ci=true" >> $GITHUB_OUTPUT
22+
echo "Cannot access SENTRY_AUTH_TOKEN, skipping CI."
23+
24+
- if: ${{ env.sentry_auth_token != '' }}
25+
run: echo "SENTRY_AUTH_TOKEN is accessible, continuing the CI checks."

0 commit comments

Comments
 (0)