-
Notifications
You must be signed in to change notification settings - Fork 6
fix: typo affecting commit and compareSHA #257
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,10 @@ import { | |
| } from "../../types.ts"; | ||
| import { type Output } from "../Output.ts"; | ||
| import { debug } from "../logging.ts"; | ||
| import { type PullRequestEvent } from "@octokit/webhooks-definitions/schema"; | ||
| import { | ||
| type PullRequestEvent, | ||
| type MergeGroupEvent, | ||
| } from "@octokit/webhooks-types"; | ||
|
|
||
| export function detect(envs: ProviderEnvs): boolean { | ||
| return Boolean(envs?.GITHUB_ACTIONS); | ||
|
|
@@ -184,9 +187,12 @@ function _getSHA( | |
|
|
||
| const context = GitHub.context; | ||
| let commit = envs?.GITHUB_SHA; | ||
| if (["pull_request", " pull_request_target"].includes(context.eventName)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nice catch on that hidden typo |
||
| if (["pull_request", "pull_request_target"].includes(context.eventName)) { | ||
| const payload = context.payload as PullRequestEvent; | ||
| commit = payload.pull_request.head.sha; | ||
| } else if ("merge_group" === context.eventName) { | ||
| const payload = context.payload as MergeGroupEvent; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it reasonable to write tests for these? |
||
| commit = payload.merge_group.head_sha; | ||
| } | ||
|
|
||
| debug(`Using commit: ${commit ?? null}`, { enabled: output.debug }); | ||
|
|
@@ -205,9 +211,12 @@ function _getCompareSHA( | |
|
|
||
| let compareSha = null; | ||
| const context = GitHub.context; | ||
| if (["pull_request", " pull_request_target"].includes(context.eventName)) { | ||
| if (["pull_request", "pull_request_target"].includes(context.eventName)) { | ||
| const payload = context.payload as PullRequestEvent; | ||
| compareSha = payload.pull_request.base.sha; | ||
| } else if ("merge_group" === context.eventName) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll defer to @JerrySentry - any backend issues if we use the synthetic merge group commit sha to upload bundle sizes? I tried to find the history but seem to recall an issue in the past related to that |
||
| const payload = context.payload as MergeGroupEvent; | ||
| compareSha = payload.merge_group.base_sha; | ||
| } | ||
|
|
||
| debug(`Using compareSha: ${compareSha}`, { enabled: output.debug }); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, thanks for moving this over