fix: remove the remote for the fork on completion
This commit is contained in:
parent
873341b21c
commit
02a8f71e34
2 changed files with 10 additions and 4 deletions
7
dist/index.js
vendored
7
dist/index.js
vendored
|
@ -320,7 +320,7 @@ const git_auth_helper_1 = __nccwpck_require__(2565);
|
||||||
const utils = __importStar(__nccwpck_require__(918));
|
const utils = __importStar(__nccwpck_require__(918));
|
||||||
function createPullRequest(inputs) {
|
function createPullRequest(inputs) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
let gitAuthHelper;
|
let gitAuthHelper, git;
|
||||||
try {
|
try {
|
||||||
if (!inputs.token) {
|
if (!inputs.token) {
|
||||||
throw new Error(`Input 'token' not supplied. Unable to continue.`);
|
throw new Error(`Input 'token' not supplied. Unable to continue.`);
|
||||||
|
@ -343,7 +343,7 @@ function createPullRequest(inputs) {
|
||||||
// Get the repository path
|
// Get the repository path
|
||||||
const repoPath = utils.getRepoPath(inputs.path);
|
const repoPath = utils.getRepoPath(inputs.path);
|
||||||
// Create a git command manager
|
// Create a git command manager
|
||||||
const git = yield git_command_manager_1.GitCommandManager.create(repoPath);
|
git = yield git_command_manager_1.GitCommandManager.create(repoPath);
|
||||||
// Save and unset the extraheader auth config if it exists
|
// Save and unset the extraheader auth config if it exists
|
||||||
core.startGroup('Prepare git configuration');
|
core.startGroup('Prepare git configuration');
|
||||||
gitAuthHelper = new git_auth_helper_1.GitAuthHelper(git);
|
gitAuthHelper = new git_auth_helper_1.GitAuthHelper(git);
|
||||||
|
@ -511,6 +511,9 @@ function createPullRequest(inputs) {
|
||||||
finally {
|
finally {
|
||||||
// Remove auth and restore persisted auth config if it existed
|
// Remove auth and restore persisted auth config if it existed
|
||||||
core.startGroup('Restore git configuration');
|
core.startGroup('Restore git configuration');
|
||||||
|
if (inputs.pushToFork) {
|
||||||
|
yield git.exec(['remote', 'rm', 'fork']);
|
||||||
|
}
|
||||||
yield gitAuthHelper.removeAuth();
|
yield gitAuthHelper.removeAuth();
|
||||||
yield gitAuthHelper.restorePersistedAuth();
|
yield gitAuthHelper.restorePersistedAuth();
|
||||||
yield gitAuthHelper.removeSafeDirectory();
|
yield gitAuthHelper.removeSafeDirectory();
|
||||||
|
|
|
@ -35,7 +35,7 @@ export interface Inputs {
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function createPullRequest(inputs: Inputs): Promise<void> {
|
export async function createPullRequest(inputs: Inputs): Promise<void> {
|
||||||
let gitAuthHelper
|
let gitAuthHelper, git
|
||||||
try {
|
try {
|
||||||
if (!inputs.token) {
|
if (!inputs.token) {
|
||||||
throw new Error(`Input 'token' not supplied. Unable to continue.`)
|
throw new Error(`Input 'token' not supplied. Unable to continue.`)
|
||||||
|
@ -61,7 +61,7 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
|
||||||
// Get the repository path
|
// Get the repository path
|
||||||
const repoPath = utils.getRepoPath(inputs.path)
|
const repoPath = utils.getRepoPath(inputs.path)
|
||||||
// Create a git command manager
|
// Create a git command manager
|
||||||
const git = await GitCommandManager.create(repoPath)
|
git = await GitCommandManager.create(repoPath)
|
||||||
|
|
||||||
// Save and unset the extraheader auth config if it exists
|
// Save and unset the extraheader auth config if it exists
|
||||||
core.startGroup('Prepare git configuration')
|
core.startGroup('Prepare git configuration')
|
||||||
|
@ -283,6 +283,9 @@ export async function createPullRequest(inputs: Inputs): Promise<void> {
|
||||||
} finally {
|
} finally {
|
||||||
// Remove auth and restore persisted auth config if it existed
|
// Remove auth and restore persisted auth config if it existed
|
||||||
core.startGroup('Restore git configuration')
|
core.startGroup('Restore git configuration')
|
||||||
|
if (inputs.pushToFork) {
|
||||||
|
await git.exec(['remote', 'rm', 'fork'])
|
||||||
|
}
|
||||||
await gitAuthHelper.removeAuth()
|
await gitAuthHelper.removeAuth()
|
||||||
await gitAuthHelper.restorePersistedAuth()
|
await gitAuthHelper.restorePersistedAuth()
|
||||||
await gitAuthHelper.removeSafeDirectory()
|
await gitAuthHelper.removeSafeDirectory()
|
||||||
|
|
Loading…
Reference in a new issue