@@ -24,38 +24,38 @@ const util_1 = require("./util");
24
24
function init ( action ) {
25
25
return __awaiter ( this , void 0 , void 0 , function * ( ) {
26
26
try {
27
- core_1 . info ( `Deploying using ${ action . tokenType } … 🔑` ) ;
28
- core_1 . info ( 'Configuring git…' ) ;
29
- yield execute_1 . execute ( `git config user.name "${ action . name } "` , action . workspace , action . silent ) ;
30
- yield execute_1 . execute ( `git config user.email "${ action . email } "` , action . workspace , action . silent ) ;
27
+ ( 0 , core_1 . info ) ( `Deploying using ${ action . tokenType } … 🔑` ) ;
28
+ ( 0 , core_1 . info ) ( 'Configuring git…' ) ;
29
+ yield ( 0 , execute_1 . execute ) ( `git config user.name "${ action . name } "` , action . workspace , action . silent ) ;
30
+ yield ( 0 , execute_1 . execute ) ( `git config user.email "${ action . email ? action . email : '<>' } "` , action . workspace , action . silent ) ;
31
31
try {
32
32
if ( ( process . env . CI && ! action . sshKey ) || action . isTest ) {
33
33
/* Ensures that previously set Git configs do not interfere with the deployment.
34
34
Only runs in the GitHub Actions CI environment if a user is not using an SSH key.
35
35
*/
36
- yield execute_1 . execute ( `git config --local --unset-all http.https://${ action . hostname } /.extraheader` , action . workspace , action . silent ) ;
36
+ yield ( 0 , execute_1 . execute ) ( `git config --local --unset-all http.https://${ action . hostname } /.extraheader` , action . workspace , action . silent ) ;
37
37
}
38
38
if ( action . isTest === constants_1 . TestFlag . UNABLE_TO_UNSET_GIT_CONFIG ) {
39
39
throw new Error ( ) ;
40
40
}
41
41
}
42
42
catch ( _a ) {
43
- core_1 . info ( 'Unable to unset previous git config authentication as it may not exist, continuing…' ) ;
43
+ ( 0 , core_1 . info ) ( 'Unable to unset previous git config authentication as it may not exist, continuing…' ) ;
44
44
}
45
45
try {
46
- yield execute_1 . execute ( `git remote rm origin` , action . workspace , action . silent ) ;
46
+ yield ( 0 , execute_1 . execute ) ( `git remote rm origin` , action . workspace , action . silent ) ;
47
47
if ( action . isTest === constants_1 . TestFlag . UNABLE_TO_REMOVE_ORIGIN ) {
48
48
throw new Error ( ) ;
49
49
}
50
50
}
51
51
catch ( _b ) {
52
- core_1 . info ( 'Attempted to remove origin but failed, continuing…' ) ;
52
+ ( 0 , core_1 . info ) ( 'Attempted to remove origin but failed, continuing…' ) ;
53
53
}
54
- yield execute_1 . execute ( `git remote add origin ${ action . repositoryPath } ` , action . workspace , action . silent ) ;
55
- core_1 . info ( 'Git configured… 🔧' ) ;
54
+ yield ( 0 , execute_1 . execute ) ( `git remote add origin ${ action . repositoryPath } ` , action . workspace , action . silent ) ;
55
+ ( 0 , core_1 . info ) ( 'Git configured… 🔧' ) ;
56
56
}
57
57
catch ( error ) {
58
- throw new Error ( `There was an error initializing the repository: ${ util_1 . suppressSensitiveInformation ( error . message , action ) } ❌` ) ;
58
+ throw new Error ( `There was an error initializing the repository: ${ ( 0 , util_1 . suppressSensitiveInformation ) ( ( 0 , util_1 . extractErrorMessage ) ( error ) , action ) } ❌` ) ;
59
59
}
60
60
} ) ;
61
61
}
@@ -67,17 +67,17 @@ function deploy(action) {
67
67
const temporaryDeploymentBranch = `github-pages-deploy-action/${ Math . random ( )
68
68
. toString ( 36 )
69
69
. substr ( 2 , 9 ) } `;
70
- core_1 . info ( 'Starting to commit changes…' ) ;
70
+ ( 0 , core_1 . info ) ( 'Starting to commit changes…' ) ;
71
71
try {
72
- const commitMessage = ! util_1 . isNullOrUndefined ( action . commitMessage )
72
+ const commitMessage = ! ( 0 , util_1 . isNullOrUndefined ) ( action . commitMessage )
73
73
? action . commitMessage
74
74
: `Deploying to ${ action . branch } ${ process . env . GITHUB_SHA
75
75
? ` from @ ${ process . env . GITHUB_REPOSITORY } @${ process . env . GITHUB_SHA } `
76
76
: '' } 🚀`;
77
77
// Checks to see if the remote exists prior to deploying.
78
78
const branchExists = action . isTest & constants_1 . TestFlag . HAS_REMOTE_BRANCH ||
79
- ( yield execute_1 . execute ( `git ls-remote --heads ${ action . repositoryPath } refs/heads/${ action . branch } ` , action . workspace , action . silent ) ) ;
80
- yield worktree_1 . generateWorktree ( action , temporaryDeploymentDirectory , branchExists ) ;
79
+ ( yield ( 0 , execute_1 . execute ) ( `git ls-remote --heads ${ action . repositoryPath } refs/heads/${ action . branch } ` , action . workspace , action . silent ) ) ;
80
+ yield ( 0 , worktree_1 . generateWorktree ) ( action , temporaryDeploymentDirectory , branchExists ) ;
81
81
// Ensures that items that need to be excluded from the clean job get parsed.
82
82
let excludes = '' ;
83
83
if ( action . clean && action . cleanExclude ) {
@@ -86,14 +86,14 @@ function deploy(action) {
86
86
}
87
87
}
88
88
if ( action . targetFolder ) {
89
- core_1 . info ( `Creating target folder if it doesn't already exist… 📌` ) ;
90
- yield io_1 . mkdirP ( `${ temporaryDeploymentDirectory } /${ action . targetFolder } ` ) ;
89
+ ( 0 , core_1 . info ) ( `Creating target folder if it doesn't already exist… 📌` ) ;
90
+ yield ( 0 , io_1 . mkdirP ) ( `${ temporaryDeploymentDirectory } /${ action . targetFolder } ` ) ;
91
91
}
92
92
/*
93
93
Pushes all of the build files into the deployment directory.
94
94
Allows the user to specify the root if '.' is provided.
95
95
rsync is used to prevent file duplication. */
96
- yield execute_1 . execute ( `rsync -q -av --checksum --progress ${ action . folderPath } /. ${ action . targetFolder
96
+ yield ( 0 , execute_1 . execute ) ( `rsync -q -av --checksum --progress ${ action . folderPath } /. ${ action . targetFolder
97
97
? `${ temporaryDeploymentDirectory } /${ action . targetFolder } `
98
98
: temporaryDeploymentDirectory } ${ action . clean
99
99
? `--delete ${ excludes } ${ ! fs_1 . default . existsSync ( `${ action . folderPath } /CNAME` )
@@ -105,7 +105,7 @@ function deploy(action) {
105
105
? `--exclude ${ temporaryDeploymentDirectory } `
106
106
: '' } `, action . workspace , action . silent ) ;
107
107
if ( action . singleCommit ) {
108
- yield execute_1 . execute ( `git add --all .` , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , action . silent ) ;
108
+ yield ( 0 , execute_1 . execute ) ( `git add --all .` , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , action . silent ) ;
109
109
}
110
110
// Use git status to check if we have something to commit.
111
111
// Special case is singleCommit with existing history, when
@@ -114,34 +114,35 @@ function deploy(action) {
114
114
const checkGitStatus = branchExists && action . singleCommit
115
115
? `git diff origin/${ action . branch } `
116
116
: `git status --porcelain` ;
117
- core_1 . info ( `Checking if there are files to commit…` ) ;
117
+ ( 0 , core_1 . info ) ( `Checking if there are files to commit…` ) ;
118
118
const hasFilesToCommit = action . isTest & constants_1 . TestFlag . HAS_CHANGED_FILES ||
119
- ( yield execute_1 . execute ( checkGitStatus , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , true // This output is always silenced due to the large output it creates.
119
+ ( yield ( 0 , execute_1 . execute ) ( checkGitStatus , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , true // This output is always silenced due to the large output it creates.
120
120
) ) ;
121
121
if ( ( ! action . singleCommit && ! hasFilesToCommit ) ||
122
122
// Ignores the case where single commit is true with a target folder to prevent incorrect early exiting.
123
123
( action . singleCommit && ! action . targetFolder && ! hasFilesToCommit ) ) {
124
124
return constants_1 . Status . SKIPPED ;
125
125
}
126
126
// Commits to GitHub.
127
- yield execute_1 . execute ( `git add --all .` , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , action . silent ) ;
128
- yield execute_1 . execute ( `git checkout -b ${ temporaryDeploymentBranch } ` , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , action . silent ) ;
129
- yield execute_1 . execute ( `git commit -m "${ commitMessage } " --quiet --no-verify` , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , action . silent ) ;
127
+ yield ( 0 , execute_1 . execute ) ( `git add --all .` , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , action . silent ) ;
128
+ yield ( 0 , execute_1 . execute ) ( `git checkout -b ${ temporaryDeploymentBranch } ` , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , action . silent ) ;
129
+ yield ( 0 , execute_1 . execute ) ( `git commit -m "${ commitMessage } " --quiet --no-verify` , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , action . silent ) ;
130
130
if ( ! action . dryRun ) {
131
- yield execute_1 . execute ( `git push --force ${ action . repositoryPath } ${ temporaryDeploymentBranch } :${ action . branch } ` , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , action . silent ) ;
131
+ yield ( 0 , execute_1 . execute ) ( `git push --force ${ action . repositoryPath } ${ temporaryDeploymentBranch } :${ action . branch } ` , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , action . silent ) ;
132
132
}
133
- core_1 . info ( `Changes committed to the ${ action . branch } branch… 📦` ) ;
133
+ ( 0 , core_1 . info ) ( `Changes committed to the ${ action . branch } branch… 📦` ) ;
134
134
return constants_1 . Status . SUCCESS ;
135
135
}
136
136
catch ( error ) {
137
- throw new Error ( `The deploy step encountered an error: ${ util_1 . suppressSensitiveInformation ( error . message , action ) } ❌` ) ;
137
+ throw new Error ( `The deploy step encountered an error: ${ ( 0 , util_1 . suppressSensitiveInformation ) ( ( 0 , util_1 . extractErrorMessage ) ( error ) , action ) } ❌` ) ;
138
138
}
139
139
finally {
140
140
// Cleans up temporary files/folders and restores the git state.
141
- core_1 . info ( 'Running post deployment cleanup jobs… 🗑️' ) ;
142
- yield execute_1 . execute ( `git checkout -B ${ temporaryDeploymentBranch } ` , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , action . silent ) ;
143
- yield execute_1 . execute ( `git worktree remove ${ temporaryDeploymentDirectory } --force` , action . workspace , action . silent ) ;
144
- yield io_1 . rmRF ( temporaryDeploymentDirectory ) ;
141
+ ( 0 , core_1 . info ) ( 'Running post deployment cleanup jobs… 🗑️' ) ;
142
+ yield ( 0 , execute_1 . execute ) ( `git checkout -B ${ temporaryDeploymentBranch } ` , `${ action . workspace } /${ temporaryDeploymentDirectory } ` , action . silent ) ;
143
+ yield ( 0 , execute_1 . execute ) ( `chmod -R 777 ${ temporaryDeploymentDirectory } ` , action . workspace , action . silent ) ;
144
+ yield ( 0 , execute_1 . execute ) ( `git worktree remove ${ temporaryDeploymentDirectory } --force` , action . workspace , action . silent ) ;
145
+ yield ( 0 , io_1 . rmRF ) ( temporaryDeploymentDirectory ) ;
145
146
}
146
147
} ) ;
147
148
}
0 commit comments