mirror of
https://github.com/JamesIves/github-pages-deploy-action.git
synced 2023-12-15 20:03:39 +08:00
parent
88b3e1921d
commit
2f337e806c
@ -2,10 +2,10 @@
|
||||
process.env['INPUT_FOLDER'] = 'build'
|
||||
process.env['GITHUB_SHA'] = '123'
|
||||
|
||||
import {mkdirP, rmRF} from '@actions/io'
|
||||
import {action} from '../src/constants'
|
||||
import {deploy, generateBranch, init, switchToBaseBranch} from '../src/git'
|
||||
import {execute} from '../src/execute'
|
||||
import {rmRF} from '@actions/io'
|
||||
import {deploy, generateBranch, init, switchToBaseBranch} from '../src/git'
|
||||
|
||||
const originalAction = JSON.stringify(action)
|
||||
|
||||
@ -17,7 +17,8 @@ jest.mock('@actions/core', () => ({
|
||||
}))
|
||||
|
||||
jest.mock('@actions/io', () => ({
|
||||
rmRF: jest.fn()
|
||||
rmRF: jest.fn(),
|
||||
mkdirP: jest.fn()
|
||||
}))
|
||||
|
||||
jest.mock('../src/execute', () => ({
|
||||
@ -402,6 +403,7 @@ describe('git', () => {
|
||||
|
||||
expect(execute).toBeCalledTimes(11)
|
||||
expect(rmRF).toBeCalledTimes(1)
|
||||
expect(mkdirP).toBeCalledTimes(1)
|
||||
})
|
||||
|
||||
it('should stop early if there is nothing to commit', async () => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import {info} from '@actions/core'
|
||||
import {rmRF} from '@actions/io'
|
||||
import {rmRF, mkdirP} from '@actions/io'
|
||||
import {ActionInterface} from './constants'
|
||||
import {execute} from './execute'
|
||||
import {
|
||||
@ -147,6 +147,11 @@ export async function deploy(action: ActionInterface): Promise<void> {
|
||||
}
|
||||
}
|
||||
|
||||
if (action.targetFolder) {
|
||||
info(`Creating target folder if it doesn't already exist… 📌`)
|
||||
await mkdirP(`${temporaryDeploymentDirectory}/${action.targetFolder}`)
|
||||
}
|
||||
|
||||
/*
|
||||
Pushes all of the build files into the deployment directory.
|
||||
Allows the user to specify the root if '.' is provided.
|
||||
|
Loading…
Reference in New Issue
Block a user