Skip to content

Commit 874899f

Browse files
committed
Fallback to git ref commit
npm run package
1 parent bb6924f commit 874899f

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎dist/index.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18478,6 +18478,12 @@ async function pullRequestInfo(payload = {}) {
1847818478
commit = pullRequest.head.sha;
1847918479
} else if (payload.after) {
1848018480
commit = payload.after;
18481+
} else if (payload.ref) {
18482+
const { data } = await client.rest.git.getRef({
18483+
ref: payload.ref.slice("refs/".length),
18484+
...github.context.repo,
18485+
});
18486+
commit = data.object.sha;
1848118487
}
1848218488

1848318489
return { pullRequestNumber, commit };

‎src/action.js‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,12 @@ async function pullRequestInfo(payload = {}) {
324324
commit = pullRequest.head.sha;
325325
} else if (payload.after) {
326326
commit = payload.after;
327+
} else if (payload.ref) {
328+
const { data } = await client.rest.git.getRef({
329+
ref: payload.ref.slice("refs/".length),
330+
...github.context.repo,
331+
});
332+
commit = data.object.sha;
327333
}
328334

329335
return { pullRequestNumber, commit };

0 commit comments

Comments
 (0)