try to fix head repo

This commit is contained in:
Peter Evans 2024-07-27 21:29:20 +00:00
parent 404696dda5
commit 03266d3789
2 changed files with 22 additions and 18 deletions

19
dist/index.js vendored
View file

@ -455,14 +455,17 @@ function createPullRequest(inputs) {
authorization: 'token ' + inputs.token
}
});
let repoOwner = process.env.GITHUB_REPOSITORY.split('/')[0];
if (inputs.pushToFork) {
const forkName = yield githubHelper.getRepositoryParent(baseRemote.repository);
if (!forkName) {
repoOwner = forkName;
}
}
const repoName = process.env.GITHUB_REPOSITORY.split('/')[1];
// let repoOwner = process.env.GITHUB_REPOSITORY!.split('/')[0]
// if (inputs.pushToFork) {
// const forkName = await githubHelper.getRepositoryParent(
// baseRemote.repository
// )
// if (!forkName) {
// repoOwner = forkName!
// }
// }
// const repoName = process.env.GITHUB_REPOSITORY!.split('/')[1]
const [repoOwner, repoName] = branchRepository.split('/');
core.debug(`repoOwner: '${repoOwner}', repoName: '${repoName}'`);
const refQuery = `
query GetRefId($repoName: String!, $repoOwner: String!, $branchName: String!) {

View file

@ -210,16 +210,17 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
}
})
let repoOwner = process.env.GITHUB_REPOSITORY!.split('/')[0]
if (inputs.pushToFork) {
const forkName = await githubHelper.getRepositoryParent(
baseRemote.repository
)
if (!forkName) {
repoOwner = forkName!
}
}
const repoName = process.env.GITHUB_REPOSITORY!.split('/')[1]
// let repoOwner = process.env.GITHUB_REPOSITORY!.split('/')[0]
// if (inputs.pushToFork) {
// const forkName = await githubHelper.getRepositoryParent(
// baseRemote.repository
// )
// if (!forkName) {
// repoOwner = forkName!
// }
// }
// const repoName = process.env.GITHUB_REPOSITORY!.split('/')[1]
const [repoOwner, repoName] = branchRepository.split('/')
core.debug(`repoOwner: '${repoOwner}', repoName: '${repoName}'`)
const refQuery = `