mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
Removes the branch
This commit is contained in:
parent
dd4a1cd6b8
commit
adea226f67
@ -341,7 +341,7 @@ describe('git', () => {
|
||||
const response = await deploy(action)
|
||||
|
||||
// Includes the call to generateBranch
|
||||
expect(execute).toBeCalledTimes(12)
|
||||
expect(execute).toBeCalledTimes(13)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
expect(response).toBe(Status.SUCCESS)
|
||||
})
|
||||
@ -361,7 +361,7 @@ describe('git', () => {
|
||||
await deploy(action)
|
||||
|
||||
// Includes the call to generateBranch
|
||||
expect(execute).toBeCalledTimes(18)
|
||||
expect(execute).toBeCalledTimes(19)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
})
|
||||
|
||||
@ -382,7 +382,7 @@ describe('git', () => {
|
||||
await deploy(action)
|
||||
|
||||
// Includes the call to generateBranch
|
||||
expect(execute).toBeCalledTimes(12)
|
||||
expect(execute).toBeCalledTimes(13)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
})
|
||||
|
||||
@ -402,7 +402,7 @@ describe('git', () => {
|
||||
await deploy(action)
|
||||
|
||||
// Includes the call to generateBranch
|
||||
expect(execute).toBeCalledTimes(12)
|
||||
expect(execute).toBeCalledTimes(13)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
})
|
||||
|
||||
@ -421,7 +421,7 @@ describe('git', () => {
|
||||
|
||||
await deploy(action)
|
||||
|
||||
expect(execute).toBeCalledTimes(12)
|
||||
expect(execute).toBeCalledTimes(13)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
expect(mkdirP).toBeCalledTimes(1)
|
||||
})
|
||||
@ -439,7 +439,7 @@ describe('git', () => {
|
||||
})
|
||||
|
||||
const response = await deploy(action)
|
||||
expect(execute).toBeCalledTimes(13)
|
||||
expect(execute).toBeCalledTimes(14)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
expect(response).toBe(Status.SKIPPED)
|
||||
})
|
||||
@ -461,7 +461,7 @@ describe('git', () => {
|
||||
try {
|
||||
await deploy(action)
|
||||
} catch (e) {
|
||||
expect(execute).toBeCalledTimes(1)
|
||||
expect(execute).toBeCalledTimes(2)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
expect(e.message).toMatch(
|
||||
'The deploy step encountered an error: No deployment token/method was provided. You must provide the action with either a Personal Access Token or the GitHub Token secret in order to deploy. If you wish to use an ssh deploy token then you must set SSH to true. ❌'
|
||||
|
@ -47,7 +47,7 @@ describe('main', () => {
|
||||
debug: true
|
||||
})
|
||||
await run(action)
|
||||
expect(execute).toBeCalledTimes(19)
|
||||
expect(execute).toBeCalledTimes(20)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
expect(exportVariable).toBeCalledTimes(1)
|
||||
})
|
||||
@ -64,7 +64,7 @@ describe('main', () => {
|
||||
}
|
||||
})
|
||||
await run(action)
|
||||
expect(execute).toBeCalledTimes(18)
|
||||
expect(execute).toBeCalledTimes(19)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
expect(exportVariable).toBeCalledTimes(1)
|
||||
})
|
||||
|
@ -67,8 +67,9 @@ export const action: ActionInterface = {
|
||||
? getInput('GIT_CONFIG_EMAIL')
|
||||
: pusher && pusher.email
|
||||
? pusher.email
|
||||
: `${process.env.GITHUB_ACTOR ||
|
||||
'github-pages-deploy-action'}@users.noreply.github.com`,
|
||||
: `${
|
||||
process.env.GITHUB_ACTOR || 'github-pages-deploy-action'
|
||||
}@users.noreply.github.com`,
|
||||
gitHubToken: getInput('GITHUB_TOKEN'),
|
||||
name: !isNullOrUndefined(getInput('GIT_CONFIG_NAME'))
|
||||
? getInput('GIT_CONFIG_NAME')
|
||||
|
@ -248,6 +248,10 @@ export async function deploy(action: ActionInterface): Promise<Status> {
|
||||
`git worktree remove ${temporaryDeploymentDirectory} --force`,
|
||||
action.workspace
|
||||
)
|
||||
await execute(
|
||||
`git branch -d ${temporaryDeploymentBranch}`,
|
||||
action.workspace
|
||||
)
|
||||
await rmRF(temporaryDeploymentDirectory)
|
||||
}
|
||||
}
|
||||
|
@ -19,10 +19,9 @@ export const generateTokenType = (action: ActionInterface): string =>
|
||||
export const generateRepositoryPath = (action: ActionInterface): string =>
|
||||
action.ssh
|
||||
? `git@github.com:${action.repositoryName}`
|
||||
: `https://${action.accessToken ||
|
||||
`x-access-token:${action.gitHubToken}`}@github.com/${
|
||||
action.repositoryName
|
||||
}.git`
|
||||
: `https://${
|
||||
action.accessToken || `x-access-token:${action.gitHubToken}`
|
||||
}@github.com/${action.repositoryName}.git`
|
||||
|
||||
/* Checks for the required tokens and formatting. Throws an error if any case is matched. */
|
||||
export const hasRequiredParameters = (action: ActionInterface): void => {
|
||||
|
Loading…
Reference in New Issue
Block a user