Skip to content

Commit

Permalink
fix: bug returning empty output for pull request close event (#1556)
Browse files Browse the repository at this point in the history
Co-authored-by: GitHub Action <[email protected]>
  • Loading branch information
jackton1 and actions-user authored Sep 9, 2023
1 parent fe0fb71 commit 246636f
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
19 changes: 12 additions & 7 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions src/commitSha.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,17 @@ export const getSHAForPullRequestEvent = async (
}
}
} else {
previousSha = await getRemoteBranchHeadSha({
cwd: workingDirectory,
branch: targetBranch
})

if (!previousSha) {
if (github.context.payload.action === 'closed') {
previousSha = github.context.payload.pull_request?.base?.sha
} else {
previousSha = await getRemoteBranchHeadSha({
cwd: workingDirectory,
branch: targetBranch
})

if (!previousSha) {
previousSha = github.context.payload.pull_request?.base?.sha
}
}

if (isShallow) {
Expand Down

0 comments on commit 246636f

Please sign in to comment.