Request:
In the github context object, add committed_at
(the commit timestamp for the commit referenced in github.sha
):
github.sha // The commit SHA that triggered the workflow run.
github.ref // The branch or tag ref that triggered the workflow run.
github.committed_at // (NEW) The commit timestamp that triggered the workflow run.
Use case:
A workflow consisting of three jobs (“frontend”, “backend”, “report”).
The frontend/backend jobs generate test coverage data, which become artifacts (uploaded with `
actions/upload-artifact@v1`).
The report job is configured as:
report:
name: Send coverage report to CodeClimate
needs: [frontend, backend]
runs-on: ubuntu-latest
steps:
...
…so that it runs after the frontend/backend jobs successfully complete.
The report job uses CodeClimate test-reporter to format & merge the two coverage artifacts into a single payload, which is uploaded to CodeClimate.
test-reporter requires three context values: GIT_BRANCH
, GIT_COMMIT_SHA
and GIT_COMMITTED_AT
.
If these ENV variables aren’t set, test-report tries to extract them from the repo (using git rev-parse
and git log
).
The “report” job doesn’t need a checkout of the source code, so test-reporter can’t get the values using git rev-parse
and git log
), meaning that the 3 x ENV vars need to be set.
Ideally these could be set as:
env:
GIT_BRANCH: ${{ github.ref }}
GIT_COMMIT_SHA: ${{ github.sha }}
GIT_COMMITTED_AT: ${{ ?? }}
However there is currently no suitable context value available for the GIT_COMMITTED_AT
var.
Workaround:
The workaround it to simply check out the code (again) in the “report” job.
But as the job only needs context info from the commit SHA that triggered the workflow, the addition of a github.committed_at
context value would remove the need for this checkout.