Skip to content
13 changes: 11 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions src/adapter/get-prs-associated-with-commit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ export default async function getPullRequestsAssociatedWithCommits(
octokit: InstanceType<typeof GitHub>,
sha: string
): Promise<PR[]> {
const triggeredFromPR =
github.context.eventName === 'pull_request' ||
github.context.eventName === 'pull_request_target'
const owner = triggeredFromPR
? github.context.payload.pull_request?.head.repo.owner.login
: github.context.repo.owner
const repo = triggeredFromPR
? github.context.payload.pull_request?.head.repo.name
: github.context.repo.repo
const result = await octokit.rest.repos.listPullRequestsAssociatedWithCommit({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
owner,
repo,
commit_sha: sha
})
core.debug(`Used url to fetch associated PRs: ${result.url}`)
Expand Down
Loading