mirror of
https://forgejo.stefka.eu/jiriks74/create-pull-request.git
synced 2025-01-18 16:01:06 +01:00
fix: use full name for head branch to allow for repo renaming (#1164)
This commit is contained in:
parent
f1a7646cea
commit
bd72e1b792
2 changed files with 17 additions and 11 deletions
|
@ -39,8 +39,12 @@ export class GitHubHelper {
|
|||
private async createOrUpdate(
|
||||
inputs: Inputs,
|
||||
baseRepository: string,
|
||||
headBranch: string
|
||||
headRepository: string
|
||||
): Promise<Pull> {
|
||||
const [headOwner] = headRepository.split('/')
|
||||
const headBranch = `${headOwner}:${inputs.branch}`
|
||||
const headBranchFull = `${headRepository}:${inputs.branch}`
|
||||
|
||||
// Try to create the pull request
|
||||
try {
|
||||
core.info(`Attempting creation of pull request`)
|
||||
|
@ -76,7 +80,7 @@ export class GitHubHelper {
|
|||
const {data: pulls} = await this.octokit.rest.pulls.list({
|
||||
...this.parseRepository(baseRepository),
|
||||
state: 'open',
|
||||
head: headBranch,
|
||||
head: headBranchFull,
|
||||
base: inputs.base
|
||||
})
|
||||
core.info(`Attempting update of pull request`)
|
||||
|
@ -113,11 +117,12 @@ export class GitHubHelper {
|
|||
baseRepository: string,
|
||||
headRepository: string
|
||||
): Promise<Pull> {
|
||||
const [headOwner] = headRepository.split('/')
|
||||
const headBranch = `${headOwner}:${inputs.branch}`
|
||||
|
||||
// Create or update the pull request
|
||||
const pull = await this.createOrUpdate(inputs, baseRepository, headBranch)
|
||||
const pull = await this.createOrUpdate(
|
||||
inputs,
|
||||
baseRepository,
|
||||
headRepository
|
||||
)
|
||||
|
||||
// Apply milestone
|
||||
if (inputs.milestone) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue