Skip to content

Commit

Permalink
fix(ci): Skip e2e metrics steps when the auth token is not available (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
antonis authored Nov 6, 2024
1 parent 5f40a37 commit d2c32bb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,14 @@ env:
jobs:
diff_check:
uses: ./.github/workflows/skip-ci.yml
auth_token_check:
uses: ./.github/workflows/skip-ci-noauth.yml
secrets: inherit

metrics:
runs-on: ${{ matrix.runs-on }}
needs: [diff_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' && env.SENTRY_AUTH_TOKEN != null }}
needs: [diff_check, auth_token_check]
if: ${{ needs.diff_check.outputs.skip_ci != 'true' && needs.auth_token_check.outputs.skip_ci != 'true' }}
env:
SENTRY_DISABLE_AUTO_UPLOAD: 'true'
strategy:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/skip-ci-noauth.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Skip CI when the auth token is not accessible

on:
workflow_call:
outputs:
skip_ci:
description: "Value 'true' if the CI cannot access the SENTRY_AUTH_TOKEN, otherwise, not defined."
value: ${{ jobs.auth_token_check.outputs.skip_ci }}

jobs:
auth_token_check:
runs-on: ubuntu-latest
env:
sentry_auth_token: ${{ secrets.SENTRY_AUTH_TOKEN }}
outputs:
skip_ci: ${{ steps.set_skip_ci.outputs.skip_ci }}
steps:
- id: set_skip_ci
if: ${{ env.sentry_auth_token == '' }}
run: |
echo "skip_ci=true" >> $GITHUB_OUTPUT
echo "Cannot access SENTRY_AUTH_TOKEN, skipping CI."
- if: ${{ env.sentry_auth_token != '' }}
run: echo "SENTRY_AUTH_TOKEN is accessible, continuing the CI checks."

0 comments on commit d2c32bb

Please sign in to comment.