Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Use the correct PR sha. #9

Merged
merged 2 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 1.5.2

- Fixed the wrong sha being display for PRs.
- Updated dependencies.

# 1.5.1

- Updated dependencies.
Expand Down
7 changes: 5 additions & 2 deletions helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ export function getCommentToken() {
}

export function getCommitInfo() {
const { repo, serverUrl, sha } = github.context;
const { repo, serverUrl, sha: baseSha } = github.context;

// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment
const sha = github.context.payload.pull_request?.head?.sha ?? baseSha;

if (!sha || !repo) {
return null;
}

return {
sha,
sha: String(sha),
url: `${serverUrl}/${repo.owner}/${repo.repo}/commit/${sha}`,
};
}
Expand Down
Loading