diff --git a/dist/index.js b/dist/index.js index be0d064..b1ccddf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3641,9 +3641,13 @@ const inputs_1 = __webpack_require__(575); const checks_1 = __webpack_require__(96); exports.envVariableName = 'DFLYDEV_CHECK_RUN_COLLECTIONS'; function run() { + var _a, _b, _c; return __awaiter(this, void 0, void 0, function* () { try { - core.debug(`GITHUB_SHA: ${process.env['GITHUB_SHA']} (${github.context.sha} from context)`); + const triggeringSha = github.context.sha; + core.debug(`GITHUB_SHA: ${process.env['GITHUB_SHA']} (${triggeringSha} from context)`); + const pullRequestHeadSha = (_c = (_b = (_a = github.context.payload) === null || _a === void 0 ? void 0 : _a.pull_request) === null || _b === void 0 ? void 0 : _b.head) === null || _c === void 0 ? void 0 : _c.sha; + core.debug(`GITHUB_PULL_REQUEST_HEAD_SHA: ${process.env['GITHUB_PULL_REQUEST_HEAD_SHA']} (${pullRequestHeadSha} from context)`); core.debug(`GITHUB_EVENT_PATH: ${process.env['GITHUB_EVENT_PATH']}`); core.debug(`Parsing inputs`); const inputs = inputs_1.parseInputs(core.getInput); @@ -3654,8 +3658,9 @@ function run() { owner: github.context.repo.owner, repo: github.context.repo.repo, }; - const sha = github.context.sha; core.debug(JSON.stringify(ownership)); + const sha = pullRequestHeadSha || triggeringSha; + core.debug(`Effective ref to attach check runs to: ${sha}`); for (const collectedCheckRun of inputs.runContext.collectedCheckRuns) { const collection = collectedCheckRun.collection; const checkRun = collectedCheckRun.checkRun; diff --git a/src/main.ts b/src/main.ts index 0ce8b42..e38fcd6 100644 --- a/src/main.ts +++ b/src/main.ts @@ -3,14 +3,18 @@ import * as github from '@actions/github' import {parseInputs} from './inputs' import {createRun, updateRun} from './checks' -import {wait} from './wait' - export const envVariableName = 'DFLYDEV_CHECK_RUN_COLLECTIONS' async function run(): Promise { try { + const triggeringSha = github.context.sha + core.debug( + `GITHUB_SHA: ${process.env['GITHUB_SHA']} (${triggeringSha} from context)`, + ) + + const pullRequestHeadSha = github.context.payload?.pull_request?.head?.sha core.debug( - `GITHUB_SHA: ${process.env['GITHUB_SHA']} (${github.context.sha} from context)`, + `GITHUB_PULL_REQUEST_HEAD_SHA: ${process.env['GITHUB_PULL_REQUEST_HEAD_SHA']} (${pullRequestHeadSha} from context)`, ) core.debug(`GITHUB_EVENT_PATH: ${process.env['GITHUB_EVENT_PATH']}`) @@ -28,10 +32,11 @@ async function run(): Promise { repo: github.context.repo.repo, } - const sha = github.context.sha - core.debug(JSON.stringify(ownership)) + const sha = pullRequestHeadSha || triggeringSha + core.debug(`Effective ref to attach check runs to: ${sha}`) + for (const collectedCheckRun of inputs.runContext.collectedCheckRuns) { const collection = collectedCheckRun.collection const checkRun = collectedCheckRun.checkRun