Skip to content

Commit 814c0b0

Browse files
authored
fix: read correct payload property for pull_request_target events (#194)
1 parent cedf10e commit 814c0b0

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

dist/nx-set-shas.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22731,9 +22731,10 @@ var BASE_SHA;
2273122731
});
2273222732
let HEAD_SHA = headResult.stdout;
2273322733
if (["pull_request", "pull_request_target"].includes(eventName) && !github.context.payload.pull_request.merged) {
22734+
const pullRequestEventName = "pull_request";
2273422735
const baseResult = spawnSync("git", [
2273522736
"merge-base",
22736-
`${remote}/${github.context.payload[eventName].base.ref}`,
22737+
`${remote}/${github.context.payload[pullRequestEventName].base.ref}`,
2273722738
"HEAD"
2273822739
], { encoding: "utf-8" });
2273922740
BASE_SHA = baseResult.stdout;

nx-set-shas.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,14 @@ let BASE_SHA: string;
4343
['pull_request', 'pull_request_target'].includes(eventName) &&
4444
!github.context.payload.pull_request.merged
4545
) {
46+
// Both pull_request and pull_request_target events have the same payload structure
47+
// https://github.com/nrwl/nx-set-shas/issues/186
48+
const pullRequestEventName = 'pull_request';
4649
const baseResult = spawnSync(
4750
'git',
4851
[
4952
'merge-base',
50-
`${remote}/${github.context.payload[eventName].base.ref}`,
53+
`${remote}/${github.context.payload[pullRequestEventName].base.ref}`,
5154
'HEAD',
5255
],
5356
{ encoding: 'utf-8' },

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"private": true,
3-
"version": "4.3.1",
3+
"version": "4.3.2",
44
"license": "MIT",
55
"description": "This package.json is here purely to control the version of the Action, in combination with https://github.com/JamesHenry/publish-shell-action",
66
"scripts": {

0 commit comments

Comments
 (0)