mirror of
https://github.com/FranzDiebold/github-env-vars-action.git
synced 2025-04-21 15:57:32 -05:00
Expose an actual SHA for pull requests as CI_PR_SHA(_SHORT).
Default CI_SHA/GITHUB_SHA is the sha of _expect-to-be_ merge/squash/etc commit of the pull requests, and it can be very confusing. If you mark you artifacts with it, its very hard to trace back what was the actual commit. CI_PR_SHA is the way I solved it for my use cases and I can see im not the first one with this problem. Fixes #30
This commit is contained in:
parent
dae1d3475c
commit
e59d29ab3b
3 changed files with 15 additions and 1 deletions
7
index.js
7
index.js
|
@ -186,6 +186,13 @@ try {
|
|||
const pullRequest = github.context.payload &&
|
||||
github.context.payload.pull_request;
|
||||
if (pullRequest) {
|
||||
const prSha = github.event.pull_request.head.sha;
|
||||
core.exportVariable('CI_PR_SHA_SHORT', getShaShort(prSha));
|
||||
core.info(`Set CI_PR_SHA_SHORT=${process.env.CI_PR_SHA_SHORT}`);
|
||||
|
||||
core.exportVariable('CI_PR_SHA', prSha);
|
||||
core.info(`Set CI_PR_SHA=${process.env.CI_PR_SHA}`);
|
||||
|
||||
const prNumber = pullRequest.number;
|
||||
core.exportVariable('CI_PR_NUMBER', prNumber);
|
||||
core.info(`Set CI_PR_NUMBER=${process.env.CI_PR_NUMBER}`);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue