From 0f5d8f2c0fb39a04111c6965142a30407a3b5e4b Mon Sep 17 00:00:00 2001 From: Franz Diebold Date: Sun, 17 Jul 2022 20:50:53 +0000 Subject: [PATCH] Fix CI_PR_SHA. --- dist/index.js | 5 +++-- index.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/dist/index.js b/dist/index.js index 996f6c0..58b53bd 100644 --- a/dist/index.js +++ b/dist/index.js @@ -192,7 +192,7 @@ try { const pullRequest = github.context.payload && github.context.payload.pull_request; if (pullRequest) { - const prSha = github.event.pull_request.head.sha; + const prSha = pullRequest.head.sha; core.exportVariable('CI_PR_SHA_SHORT', getShaShort(prSha)); core.info(`Set CI_PR_SHA_SHORT=${process.env.CI_PR_SHA_SHORT}`); @@ -215,7 +215,8 @@ try { core.info(`Set CI_PR_DESCRIPTION=${process.env.CI_PR_DESCRIPTION}`); } else { core.info('No pull request. ' + - 'Cannot set "CI_PR_TITLE" and "CI_PR_DESCRIPTION".'); + 'Cannot set "CI_PR_SHA_SHORT", "CI_PR_SHA", "CI_PR_NUMBER", ' + + '"CI_PR_ID", "CI_PR_TITLE" and "CI_PR_DESCRIPTION".'); } const actor = process.env.GITHUB_ACTOR; diff --git a/index.js b/index.js index 4830fd4..3b089f4 100644 --- a/index.js +++ b/index.js @@ -186,7 +186,7 @@ try { const pullRequest = github.context.payload && github.context.payload.pull_request; if (pullRequest) { - const prSha = github.event.pull_request.head.sha; + const prSha = pullRequest.head.sha; core.exportVariable('CI_PR_SHA_SHORT', getShaShort(prSha)); core.info(`Set CI_PR_SHA_SHORT=${process.env.CI_PR_SHA_SHORT}`); @@ -209,7 +209,8 @@ try { core.info(`Set CI_PR_DESCRIPTION=${process.env.CI_PR_DESCRIPTION}`); } else { core.info('No pull request. ' + - 'Cannot set "CI_PR_TITLE" and "CI_PR_DESCRIPTION".'); + 'Cannot set "CI_PR_SHA_SHORT", "CI_PR_SHA", "CI_PR_NUMBER", ' + + '"CI_PR_ID", "CI_PR_TITLE" and "CI_PR_DESCRIPTION".'); } const actor = process.env.GITHUB_ACTOR;