mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
[Issue-107] Fixes an issue that prevents new branches from being created (#108)
* test * l * x * Tests
This commit is contained in:
parent
e23cb300bf
commit
a6723fe785
@ -30,7 +30,7 @@ describe("git", () => {
|
||||
});
|
||||
|
||||
const call = await init();
|
||||
expect(execute).toBeCalledTimes(3);
|
||||
expect(execute).toBeCalledTimes(4);
|
||||
expect(call).toBe("Initialization step complete...");
|
||||
});
|
||||
|
||||
@ -46,7 +46,7 @@ describe("git", () => {
|
||||
|
||||
const call = await init();
|
||||
|
||||
expect(execute).toBeCalledTimes(3);
|
||||
expect(execute).toBeCalledTimes(4);
|
||||
expect(call).toBe("Initialization step complete...");
|
||||
});
|
||||
|
||||
@ -109,7 +109,7 @@ describe("git", () => {
|
||||
|
||||
const call = await init();
|
||||
|
||||
expect(execute).toBeCalledTimes(3);
|
||||
expect(execute).toBeCalledTimes(4);
|
||||
expect(call).toBe("Initialization step complete...");
|
||||
});
|
||||
});
|
||||
|
@ -68,7 +68,6 @@ function generateBranch() {
|
||||
yield util_1.execute(`git reset --hard`, constants_1.workspace);
|
||||
yield util_1.execute(`git commit --allow-empty -m "Initial ${constants_1.action.branch} commit."`, constants_1.workspace);
|
||||
yield util_1.execute(`git push ${constants_1.repositoryPath} ${constants_1.action.branch}`, constants_1.workspace);
|
||||
// Switches back to the base branch.
|
||||
yield switchToBaseBranch();
|
||||
}
|
||||
catch (error) {
|
||||
@ -98,7 +97,7 @@ function deploy() {
|
||||
}
|
||||
// Checks out the base branch to begin the deployment process.
|
||||
yield switchToBaseBranch();
|
||||
yield util_1.execute(`git fetch ${constants_1.repositoryPath}`, constants_1.workspace);
|
||||
yield util_1.execute(`git fetch origin`, constants_1.workspace);
|
||||
yield util_1.execute(`git worktree add --checkout ${temporaryDeploymentDirectory} origin/${constants_1.action.branch}`, constants_1.workspace);
|
||||
// Ensures that items that need to be excluded from the clean job get parsed.
|
||||
let excludes = "";
|
||||
|
@ -22,6 +22,7 @@ export async function init(): Promise<any> {
|
||||
await execute(`git init`, workspace);
|
||||
await execute(`git config user.name ${action.name}`, workspace);
|
||||
await execute(`git config user.email ${action.email}`, workspace);
|
||||
await execute(`git fetch origin`, workspace);
|
||||
} catch (error) {
|
||||
core.setFailed(`There was an error initializing the repository: ${error}`);
|
||||
} finally {
|
||||
@ -88,7 +89,7 @@ export async function deploy(): Promise<any> {
|
||||
|
||||
// Checks out the base branch to begin the deployment process.
|
||||
await switchToBaseBranch();
|
||||
await execute(`git fetch ${repositoryPath}`, workspace);
|
||||
await execute(`git fetch origin`, workspace);
|
||||
await execute(
|
||||
`git worktree add --checkout ${temporaryDeploymentDirectory} origin/${action.branch}`,
|
||||
workspace
|
||||
|
Loading…
Reference in New Issue
Block a user