Skip to content

Commit

Permalink
Fallback to git ref commit
Browse files Browse the repository at this point in the history
npm run package
  • Loading branch information
gitfool committed Dec 8, 2021
1 parent bb6924f commit 874899f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18478,6 +18478,12 @@ async function pullRequestInfo(payload = {}) {
commit = pullRequest.head.sha;
} else if (payload.after) {
commit = payload.after;
} else if (payload.ref) {
const { data } = await client.rest.git.getRef({
ref: payload.ref.slice("refs/".length),
...github.context.repo,
});
commit = data.object.sha;
}

return { pullRequestNumber, commit };
Expand Down
6 changes: 6 additions & 0 deletions src/action.js
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,12 @@ async function pullRequestInfo(payload = {}) {
commit = pullRequest.head.sha;
} else if (payload.after) {
commit = payload.after;
} else if (payload.ref) {
const { data } = await client.rest.git.getRef({
ref: payload.ref.slice("refs/".length),
...github.context.repo,
});
commit = data.object.sha;
}

return { pullRequestNumber, commit };
Expand Down

0 comments on commit 874899f

Please sign in to comment.