From 91cb03b0fc52256eeca096c154b9edb067418f96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 23 Jan 2020 19:01:18 +0100 Subject: [PATCH] Workaround coverage reporting to codeclimate (#623) Codeclimate's test-reporter does not yet support Github Actions. To workaround that, we need to make sure we pass the generic `GIT_BRANCH` and `GIT_COMMIT_SHA` environment variables to the command that generates the reports in the format codeclimate understands. Since this information is not available by default in Github Actions, we do a bit of `git` manipulation to find it. --- .github/workflows/build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 52deb8bc2..a04f34f96 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,9 @@ jobs: bin/rake - name: Save coverage - run: cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.version }}-${{ matrix.line_editor }}-${{ matrix.compiler }}.json + run: | + git fetch --no-tags --prune --depth=1 origin +refs/heads/$GITHUB_HEAD_REF:refs/remotes/origin/$GITHUB_HEAD_REF + GIT_BRANCH=$GITHUB_HEAD_REF GIT_COMMIT_SHA=$(git rev-parse origin/$GITHUB_HEAD_REF) cc-test-reporter format-coverage --output coverage/codeclimate.${{ matrix.version }}-${{ matrix.line_editor }}-${{ matrix.compiler }}.json - uses: actions/upload-artifact@v1 with: