File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22process . env [ 'INPUT_FOLDER' ] = 'build'
33process . env [ 'GITHUB_SHA' ] = '123'
44
5+ import { mkdirP , rmRF } from '@actions/io'
56import { action } from '../src/constants'
6- import { deploy , generateBranch , init , switchToBaseBranch } from '../src/git'
77import { execute } from '../src/execute'
8- import { rmRF } from '@actions/io '
8+ import { deploy , generateBranch , init , switchToBaseBranch } from '../src/git '
99
1010const originalAction = JSON . stringify ( action )
1111
@@ -17,7 +17,8 @@ jest.mock('@actions/core', () => ({
1717} ) )
1818
1919jest . mock ( '@actions/io' , ( ) => ( {
20- rmRF : jest . fn ( )
20+ rmRF : jest . fn ( ) ,
21+ mkdirP : jest . fn ( )
2122} ) )
2223
2324jest . mock ( '../src/execute' , ( ) => ( {
@@ -402,6 +403,7 @@ describe('git', () => {
402403
403404 expect ( execute ) . toBeCalledTimes ( 11 )
404405 expect ( rmRF ) . toBeCalledTimes ( 1 )
406+ expect ( mkdirP ) . toBeCalledTimes ( 1 )
405407 } )
406408
407409 it ( 'should stop early if there is nothing to commit' , async ( ) => {
Original file line number Diff line number Diff line change 11import { info } from '@actions/core'
2- import { rmRF } from '@actions/io'
2+ import { rmRF , mkdirP } from '@actions/io'
33import { ActionInterface } from './constants'
44import { execute } from './execute'
55import {
@@ -147,6 +147,11 @@ export async function deploy(action: ActionInterface): Promise<void> {
147147 }
148148 }
149149
150+ if ( action . targetFolder ) {
151+ info ( `Creating target folder if it doesn't already exist… 📌` )
152+ await mkdirP ( `${ temporaryDeploymentDirectory } /${ action . targetFolder } ` )
153+ }
154+
150155 /*
151156 Pushes all of the build files into the deployment directory.
152157 Allows the user to specify the root if '.' is provided.
You can’t perform that action at this time.
0 commit comments