diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 1bc495595e..85156093f7 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -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 ✓ @@ -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: @@ -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 @@ -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