Skip to content

Commit

Permalink
use env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon committed Oct 21, 2022
1 parent 0af92c1 commit e900467
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,17 @@ on:
- main
pull_request_target:

env:
SHA:
${{ github.event_name == 'pull_request_target' &&
github.event.pull_request.head.sha || github.sha }}
REF:
${{ github.event_name == 'pull_request_target' &&
github.event.pull_request.head.ref || github.ref }}
REF_NAME:
${{ github.event_name == 'pull_request_target' && github.head_ref ||
github.ref_name }}

concurrency:
group: continuous-integration-${{ github.head_ref }}
cancel-in-progress: true
Expand All @@ -15,6 +26,7 @@ jobs:
${{ (github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository) &&
'external' || 'internal' }}

runs-on: ubuntu-latest
steps:
- run: echo ✓
Expand All @@ -24,10 +36,6 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Dump GitHub context
id: github_context_step
run: echo '${{ toJSON(github) }}'

- name: Checkout
uses: actions/checkout@v3
with:
Expand All @@ -48,14 +56,14 @@ jobs:
cache: 'yarn'

- name: Turbo cache
if: ${{ github.ref_name != 'main' }}
if: ${{ env.REF_NAME != 'main' }}
id: turbo-cache
uses: actions/cache@v3
with:
path: node_modules/.cache/turbo
key: turbo-${{ github.job }}-${{ github.ref_name }}-${{ github.sha }}
key: turbo-${{ github.job }}-${{ env.REF_NAME }}-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
turbo-${{ github.job }}-${{ env.REF_NAME }}-
- run: yarn run install-frozen-lockfile

Expand All @@ -64,9 +72,8 @@ jobs:
- uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
GITHUB_EVENT_NAME:
${{ github.event_name == 'pull_request_target' && 'pull_request' ||
github.event_name }}
GITHUB_SHA: ${{ env.SHA }}
GITHUB_REF: ${{ env.REF }}
with:
coverageCommand: xvfb-run -a yarn run cover
coverageLocations: ${{github.workspace}}/coverage/lcov.info:lcov
Expand Down

0 comments on commit e900467

Please sign in to comment.