fix: bug with prs from forks returning incorrect set of changed files (#2007)

Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
Tonye Jack
2024-03-26 11:47:25 -06:00
committed by GitHub
parent 0713a11242
commit 4ff79362e5
5 changed files with 187 additions and 94 deletions

View File

@@ -685,14 +685,16 @@ export const isInsideWorkTree = async ({
export const getRemoteBranchHeadSha = async ({
cwd,
branch
branch,
remoteName
}: {
cwd: string
branch: string
remoteName: string
}): Promise<string> => {
const {stdout} = await exec.getExecOutput(
'git',
['rev-parse', `origin/${branch}`],
['rev-parse', `${remoteName}/${branch}`],
{
cwd,
silent: !core.isDebug()
@@ -742,6 +744,24 @@ export const getParentSha = async ({cwd}: {cwd: string}): Promise<string> => {
return stdout.trim()
}
export const setForkRemote = async ({cwd}: {cwd: string}): Promise<void> => {
if (github.context.payload.repository?.fork) {
await exec.getExecOutput(
'git',
[
'remote',
'set-url',
'fork',
github.context.payload.repository?.clone_url
],
{
cwd,
silent: !core.isDebug()
}
)
}
}
export const verifyCommitSha = async ({
sha,
cwd,