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 9a2d16c
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,28 @@ 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 }}
ENV_NAME:
${{ (github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository) &&
'external' || 'internal' }}

concurrency:
group: continuous-integration-${{ github.head_ref }}
cancel-in-progress: true

jobs:
authorize:
environment:
${{ (github.event_name == 'pull_request_target' &&
github.event.pull_request.head.repo.full_name != github.repository) &&
'external' || 'internal' }}
environment: $ENV_NAME
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: ${{ $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 }}-$REF_NAME-${{ github.sha }}
restore-keys: |
turbo-${{ github.job }}-${{ github.ref_name }}-
turbo-${{ github.job }}-$REF_NAME-
- run: yarn run install-frozen-lockfile

Expand All @@ -64,9 +72,8 @@ jobs:
- uses: paambaati/codeclimate-action@v3.1.1
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: $SHA
GITHUB_REF: $REF
with:
coverageCommand: xvfb-run -a yarn run cover
coverageLocations: ${{github.workspace}}/coverage/lcov.info:lcov
Expand Down

0 comments on commit 9a2d16c

Please sign in to comment.