* feat: restore working base branch and uncommitted changes

* docs: uncommitted changes are stashed and restored

* docs: add major version notes

* fix: update package version

* fix: update package-lock

* feat: revise proxy implementation

* docs: add notes for the revised proxy implementation

* feat: set and remove git safe directory

* docs: add notes for the git safe directory feature

* fix: use base url for proxy check

* feat: determine the git dir with rev-parse

* build: update package lock

* fix: remove support for ghes alpha

* feat: revise handling of team reviewers

* docs: update notes

* feat: body-path

* docs: update to v5

* docs: update to v5

* build: fix package lock
This commit is contained in:
Peter Evans 2023-04-05 08:41:18 +09:00 committed by GitHub
parent 1847e5d1d6
commit 5b4a9f6a9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 501 additions and 59041 deletions

View file

@ -24,6 +24,7 @@ export interface Inputs {
pushToFork: string
title: string
body: string
bodyPath: string
labels: string[]
assignees: string[]
reviewers: string[]
@ -38,6 +39,13 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
if (!inputs.token) {
throw new Error(`Input 'token' not supplied. Unable to continue.`)
}
if (inputs.bodyPath) {
if (!utils.fileExistsSync(inputs.bodyPath)) {
throw new Error(`File '${inputs.bodyPath}' does not exist.`)
}
// Update the body input with the contents of the file
inputs.body = utils.readFile(inputs.bodyPath)
}
// Get the repository path
const repoPath = utils.getRepoPath(inputs.path)
@ -45,8 +53,9 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
const git = await GitCommandManager.create(repoPath)
// Save and unset the extraheader auth config if it exists
core.startGroup('Save persisted git credentials')
core.startGroup('Prepare git configuration')
gitAuthHelper = new GitAuthHelper(git)
await gitAuthHelper.addSafeDirectory()
await gitAuthHelper.savePersistedAuth()
core.endGroup()
@ -195,7 +204,7 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
await git.push([
'--force-with-lease',
branchRemoteName,
`HEAD:refs/heads/${inputs.branch}`
`${inputs.branch}:refs/heads/${inputs.branch}`
])
core.endGroup()
}
@ -252,9 +261,10 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
core.setFailed(utils.getErrorMessage(error))
} finally {
// Remove auth and restore persisted auth config if it existed
core.startGroup('Restore persisted git credentials')
core.startGroup('Restore git configuration')
await gitAuthHelper.removeAuth()
await gitAuthHelper.restorePersistedAuth()
await gitAuthHelper.removeSafeDirectory()
core.endGroup()
}
}