Skip to content

Commit

Permalink
SC-83560: Fix getting commit hash (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
iansu authored Feb 8, 2022
1 parent 82a30dc commit 0ffd2ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @iansu
18 changes: 9 additions & 9 deletions src/get-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,20 @@ const getData = async (): Promise<PRData> => {
const info = context.payload;

if (info.pull_request) {
prData.ref = `${info.pull_request.head.ref}`;
prData.baseRef = `${info.pull_request.base.ref}`;
prData.sha = `${info.pull_request.merge_commit_sha}`;
prData.timestamp = `${info.pull_request.created_at}`;
prData.ref = info.pull_request.head.ref;
prData.baseRef = info.pull_request.base.ref;
prData.sha = info.pull_request.head.sha;
prData.timestamp = info.pull_request.created_at;
prData.pullRequest = info.number;
} else {
prData.ref = `${info.ref.replace('refs/heads/', '')}`;
prData.baseRef = `${info.base_ref}`;
prData.sha = `${info.after}`;
prData.timestamp = `${info.head_commit.timestamp}`;
prData.ref = info.ref.replace('refs/heads/', '');
prData.baseRef = info.base_ref;
prData.sha = info.after;
prData.timestamp = info.head_commit.timestamp;
}

if (info.repository && info.sender) {
prData.actor = `${info.sender.login}`;
prData.actor = info.sender.login;
} else {
throw new Error('Issue with context');
}
Expand Down

0 comments on commit 0ffd2ee

Please sign in to comment.