From 6eed90fb615633db15d631ca8e3087471ad5f99d Mon Sep 17 00:00:00 2001 From: Godfrey Chan Date: Tue, 31 Mar 2020 07:30:54 -0700 Subject: [PATCH] Fix code coverage report (#1167) Code Climate uses the `GIT_COMMIT_SHA` and `GIT_BRANCH` environment variables for the reports. --- .github/workflows/build.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a4b1a5fd93..7c24f01ca7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,23 @@ jobs: steps: - name: Checkout uses: actions/checkout@v1 + # Code Climate expects these variables to be set + - name: Set up commit metadata + if: github.event_name == 'push' + env: + GIT_COMMIT_SHA: ${{ github.sha }} + GIT_BRANCH: ${{ github.ref }} + run: | + echo "::set-env name=GIT_COMMIT_SHA::${GIT_COMMIT_SHA}" + echo "::set-env name=GIT_BRANCH::${GIT_BRANCH/refs\/heads\//}" + - name: Set up commit metadata + if: github.event_name == 'pull_request' + env: + GIT_COMMIT_SHA: ${{ github.event.pull_request.head.sha }} + GIT_BRANCH: ${{ github.event.pull_request.head.ref }} + run: | + echo "::set-env name=GIT_COMMIT_SHA::${GIT_COMMIT_SHA}" + echo "::set-env name=GIT_BRANCH::${GIT_BRANCH}" - name: Set up Volta uses: rwjblue/setup-volta@v1 - name: Install dependencies (yarn) @@ -51,6 +68,7 @@ jobs: # EMBER_ENV: test # COVERAGE: 'true' - name: Report coverage + if: github.event_name != 'schedule' run: yarn codeclimate-test-reporter < coverage/lcov.info env: CODECLIMATE_REPO_TOKEN: 59edcfd1ffc778791af49ca594b503e7179f6bbe1991b2cc0c0a6987d103253d