@@ -771,6 +771,32 @@ const windowsRelease = release => {
771
771
module . exports = windowsRelease ;
772
772
773
773
774
+ /***/ } ) ,
775
+
776
+ /***/ 82 :
777
+ /***/ ( function ( __unusedmodule , exports ) {
778
+
779
+ "use strict" ;
780
+
781
+ // We use any as a valid input type
782
+ /* eslint-disable @typescript-eslint/no-explicit-any */
783
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
784
+ /**
785
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
786
+ * @param input input to sanitize into a string
787
+ */
788
+ function toCommandValue ( input ) {
789
+ if ( input === null || input === undefined ) {
790
+ return '' ;
791
+ }
792
+ else if ( typeof input === 'string' || input instanceof String ) {
793
+ return input ;
794
+ }
795
+ return JSON . stringify ( input ) ;
796
+ }
797
+ exports . toCommandValue = toCommandValue ;
798
+ //# sourceMappingURL=utils.js.map
799
+
774
800
/***/ } ) ,
775
801
776
802
/***/ 87 :
@@ -780,6 +806,42 @@ module.exports = require("os");
780
806
781
807
/***/ } ) ,
782
808
809
+ /***/ 102 :
810
+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
811
+
812
+ "use strict" ;
813
+
814
+ // For internal use, subject to change.
815
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
816
+ if ( mod && mod . __esModule ) return mod ;
817
+ var result = { } ;
818
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
819
+ result [ "default" ] = mod ;
820
+ return result ;
821
+ } ;
822
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
823
+ // We use any as a valid input type
824
+ /* eslint-disable @typescript-eslint/no-explicit-any */
825
+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
826
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
827
+ const utils_1 = __webpack_require__ ( 82 ) ;
828
+ function issueCommand ( command , message ) {
829
+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
830
+ if ( ! filePath ) {
831
+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
832
+ }
833
+ if ( ! fs . existsSync ( filePath ) ) {
834
+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
835
+ }
836
+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
837
+ encoding : 'utf8'
838
+ } ) ;
839
+ }
840
+ exports . issueCommand = issueCommand ;
841
+ //# sourceMappingURL=file-command.js.map
842
+
843
+ /***/ } ) ,
844
+
783
845
/***/ 118 :
784
846
/***/ ( function ( module , __unusedexports , __webpack_require__ ) {
785
847
@@ -4834,17 +4896,25 @@ function octokitValidate (octokit) {
4834
4896
4835
4897
"use strict" ;
4836
4898
4899
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
4900
+ if ( mod && mod . __esModule ) return mod ;
4901
+ var result = { } ;
4902
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
4903
+ result [ "default" ] = mod ;
4904
+ return result ;
4905
+ } ;
4837
4906
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
4838
- const os = __webpack_require__ ( 87 ) ;
4907
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
4908
+ const utils_1 = __webpack_require__ ( 82 ) ;
4839
4909
/**
4840
4910
* Commands
4841
4911
*
4842
4912
* Command Format:
4843
- * ##[ name key=value; key=value] message
4913
+ * :: name key=value, key=value:: message
4844
4914
*
4845
4915
* Examples:
4846
- * ##[ warning] This is the user warning message
4847
- * ##[ set-secret name=mypassword]definitelyNotAPassword!
4916
+ * :: warning:: This is the message
4917
+ * :: set-env name=MY_VAR::some value
4848
4918
*/
4849
4919
function issueCommand ( command , properties , message ) {
4850
4920
const cmd = new Command ( command , properties , message ) ;
@@ -4855,7 +4925,7 @@ function issue(name, message = '') {
4855
4925
issueCommand ( name , { } , message ) ;
4856
4926
}
4857
4927
exports . issue = issue ;
4858
- const CMD_PREFIX = '##[ ' ;
4928
+ const CMD_STRING = ':: ' ;
4859
4929
class Command {
4860
4930
constructor ( command , properties , message ) {
4861
4931
if ( ! command ) {
@@ -4866,37 +4936,42 @@ class Command {
4866
4936
this . message = message ;
4867
4937
}
4868
4938
toString ( ) {
4869
- let cmdStr = CMD_PREFIX + this . command ;
4939
+ let cmdStr = CMD_STRING + this . command ;
4870
4940
if ( this . properties && Object . keys ( this . properties ) . length > 0 ) {
4871
4941
cmdStr += ' ' ;
4942
+ let first = true ;
4872
4943
for ( const key in this . properties ) {
4873
4944
if ( this . properties . hasOwnProperty ( key ) ) {
4874
4945
const val = this . properties [ key ] ;
4875
4946
if ( val ) {
4876
- // safely append the val - avoid blowing up when attempting to
4877
- // call .replace() if message is not a string for some reason
4878
- cmdStr += `${ key } =${ escape ( `${ val || '' } ` ) } ;` ;
4947
+ if ( first ) {
4948
+ first = false ;
4949
+ }
4950
+ else {
4951
+ cmdStr += ',' ;
4952
+ }
4953
+ cmdStr += `${ key } =${ escapeProperty ( val ) } ` ;
4879
4954
}
4880
4955
}
4881
4956
}
4882
4957
}
4883
- cmdStr += ']' ;
4884
- // safely append the message - avoid blowing up when attempting to
4885
- // call .replace() if message is not a string for some reason
4886
- const message = `${ this . message || '' } ` ;
4887
- cmdStr += escapeData ( message ) ;
4958
+ cmdStr += `${ CMD_STRING } ${ escapeData ( this . message ) } ` ;
4888
4959
return cmdStr ;
4889
4960
}
4890
4961
}
4891
4962
function escapeData ( s ) {
4892
- return s . replace ( / \r / g, '%0D' ) . replace ( / \n / g, '%0A' ) ;
4963
+ return utils_1 . toCommandValue ( s )
4964
+ . replace ( / % / g, '%25' )
4965
+ . replace ( / \r / g, '%0D' )
4966
+ . replace ( / \n / g, '%0A' ) ;
4893
4967
}
4894
- function escape ( s ) {
4895
- return s
4968
+ function escapeProperty ( s ) {
4969
+ return utils_1 . toCommandValue ( s )
4970
+ . replace ( / % / g, '%25' )
4896
4971
. replace ( / \r / g, '%0D' )
4897
4972
. replace ( / \n / g, '%0A' )
4898
- . replace ( / ] / g, '%5D ' )
4899
- . replace ( / ; / g, '%3B ' ) ;
4973
+ . replace ( / : / g, '%3A ' )
4974
+ . replace ( / , / g, '%2C ' ) ;
4900
4975
}
4901
4976
//# sourceMappingURL=command.js.map
4902
4977
@@ -5462,6 +5537,12 @@ function convertBody(buffer, headers) {
5462
5537
// html4
5463
5538
if ( ! res && str ) {
5464
5539
res = / < m e t a [ \s ] + ?h t t p - e q u i v = ( [ ' " ] ) c o n t e n t - t y p e \1[ \s ] + ?c o n t e n t = ( [ ' " ] ) ( .+ ?) \2/ i. exec ( str ) ;
5540
+ if ( ! res ) {
5541
+ res = / < m e t a [ \s ] + ?c o n t e n t = ( [ ' " ] ) ( .+ ?) \1[ \s ] + ?h t t p - e q u i v = ( [ ' " ] ) c o n t e n t - t y p e \3/ i. exec ( str ) ;
5542
+ if ( res ) {
5543
+ res . pop ( ) ; // drop last quote
5544
+ }
5545
+ }
5465
5546
5466
5547
if ( res ) {
5467
5548
res = / c h a r s e t = ( .* ) / i. exec ( res . pop ( ) ) ;
@@ -6469,7 +6550,7 @@ function fetch(url, opts) {
6469
6550
// HTTP fetch step 5.5
6470
6551
switch ( request . redirect ) {
6471
6552
case 'error' :
6472
- reject ( new FetchError ( `redirect mode is set to error: ${ request . url } ` , 'no-redirect' ) ) ;
6553
+ reject ( new FetchError ( `uri requested responds with a redirect, redirect mode is set to error: ${ request . url } ` , 'no-redirect' ) ) ;
6473
6554
finalize ( ) ;
6474
6555
return ;
6475
6556
case 'manual' :
@@ -6508,7 +6589,8 @@ function fetch(url, opts) {
6508
6589
method : request . method ,
6509
6590
body : request . body ,
6510
6591
signal : request . signal ,
6511
- timeout : request . timeout
6592
+ timeout : request . timeout ,
6593
+ size : request . size
6512
6594
} ;
6513
6595
6514
6596
// HTTP-redirect fetch step 9
@@ -6770,9 +6852,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
6770
6852
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
6771
6853
} ) ;
6772
6854
} ;
6855
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
6856
+ if ( mod && mod . __esModule ) return mod ;
6857
+ var result = { } ;
6858
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
6859
+ result [ "default" ] = mod ;
6860
+ return result ;
6861
+ } ;
6773
6862
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
6774
6863
const command_1 = __webpack_require__ ( 431 ) ;
6775
- const path = __webpack_require__ ( 622 ) ;
6864
+ const file_command_1 = __webpack_require__ ( 102 ) ;
6865
+ const utils_1 = __webpack_require__ ( 82 ) ;
6866
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
6867
+ const path = __importStar ( __webpack_require__ ( 622 ) ) ;
6776
6868
/**
6777
6869
* The code to exit an action
6778
6870
*/
@@ -6791,34 +6883,45 @@ var ExitCode;
6791
6883
// Variables
6792
6884
//-----------------------------------------------------------------------
6793
6885
/**
6794
- * sets env variable for this action and future actions in the job
6886
+ * Sets env variable for this action and future actions in the job
6795
6887
* @param name the name of the variable to set
6796
- * @param val the value of the variable
6888
+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
6797
6889
*/
6890
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6798
6891
function exportVariable ( name , val ) {
6799
- process . env [ name ] = val ;
6800
- command_1 . issueCommand ( 'set-env' , { name } , val ) ;
6892
+ const convertedVal = utils_1 . toCommandValue ( val ) ;
6893
+ process . env [ name ] = convertedVal ;
6894
+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
6895
+ if ( filePath ) {
6896
+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
6897
+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
6898
+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
6899
+ }
6900
+ else {
6901
+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
6902
+ }
6801
6903
}
6802
6904
exports . exportVariable = exportVariable ;
6803
6905
/**
6804
- * exports the variable and registers a secret which will get masked from logs
6805
- * @param name the name of the variable to set
6806
- * @param val value of the secret
6906
+ * Registers a secret which will get masked from logs
6907
+ * @param secret value of the secret
6807
6908
*/
6808
- function exportSecret ( name , val ) {
6809
- exportVariable ( name , val ) ;
6810
- // the runner will error with not implemented
6811
- // leaving the function but raising the error earlier
6812
- command_1 . issueCommand ( 'set-secret' , { } , val ) ;
6813
- throw new Error ( 'Not implemented.' ) ;
6909
+ function setSecret ( secret ) {
6910
+ command_1 . issueCommand ( 'add-mask' , { } , secret ) ;
6814
6911
}
6815
- exports . exportSecret = exportSecret ;
6912
+ exports . setSecret = setSecret ;
6816
6913
/**
6817
6914
* Prepends inputPath to the PATH (for this action and future actions)
6818
6915
* @param inputPath
6819
6916
*/
6820
6917
function addPath ( inputPath ) {
6821
- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
6918
+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
6919
+ if ( filePath ) {
6920
+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
6921
+ }
6922
+ else {
6923
+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
6924
+ }
6822
6925
process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
6823
6926
}
6824
6927
exports . addPath = addPath ;
@@ -6830,7 +6933,7 @@ exports.addPath = addPath;
6830
6933
* @returns string
6831
6934
*/
6832
6935
function getInput ( name , options ) {
6833
- const val = process . env [ `INPUT_${ name . replace ( ' ' , '_' ) . toUpperCase ( ) } ` ] || '' ;
6936
+ const val = process . env [ `INPUT_${ name . replace ( / / g , '_' ) . toUpperCase ( ) } ` ] || '' ;
6834
6937
if ( options && options . required && ! val ) {
6835
6938
throw new Error ( `Input required and not supplied: ${ name } ` ) ;
6836
6939
}
@@ -6841,12 +6944,22 @@ exports.getInput = getInput;
6841
6944
* Sets the value of an output.
6842
6945
*
6843
6946
* @param name name of the output to set
6844
- * @param value value to store
6947
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
6845
6948
*/
6949
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6846
6950
function setOutput ( name , value ) {
6847
6951
command_1 . issueCommand ( 'set-output' , { name } , value ) ;
6848
6952
}
6849
6953
exports . setOutput = setOutput ;
6954
+ /**
6955
+ * Enables or disables the echoing of commands into stdout for the rest of the step.
6956
+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
6957
+ *
6958
+ */
6959
+ function setCommandEcho ( enabled ) {
6960
+ command_1 . issue ( 'echo' , enabled ? 'on' : 'off' ) ;
6961
+ }
6962
+ exports . setCommandEcho = setCommandEcho ;
6850
6963
//-----------------------------------------------------------------------
6851
6964
// Results
6852
6965
//-----------------------------------------------------------------------
@@ -6863,6 +6976,13 @@ exports.setFailed = setFailed;
6863
6976
//-----------------------------------------------------------------------
6864
6977
// Logging Commands
6865
6978
//-----------------------------------------------------------------------
6979
+ /**
6980
+ * Gets whether Actions Step Debug is on or not
6981
+ */
6982
+ function isDebug ( ) {
6983
+ return process . env [ 'RUNNER_DEBUG' ] === '1' ;
6984
+ }
6985
+ exports . isDebug = isDebug ;
6866
6986
/**
6867
6987
* Writes debug message to user log
6868
6988
* @param message debug message
@@ -6873,20 +6993,28 @@ function debug(message) {
6873
6993
exports . debug = debug ;
6874
6994
/**
6875
6995
* Adds an error issue
6876
- * @param message error issue message
6996
+ * @param message error issue message. Errors will be converted to string via toString()
6877
6997
*/
6878
6998
function error ( message ) {
6879
- command_1 . issue ( 'error' , message ) ;
6999
+ command_1 . issue ( 'error' , message instanceof Error ? message . toString ( ) : message ) ;
6880
7000
}
6881
7001
exports . error = error ;
6882
7002
/**
6883
7003
* Adds an warning issue
6884
- * @param message warning issue message
7004
+ * @param message warning issue message. Errors will be converted to string via toString()
6885
7005
*/
6886
7006
function warning ( message ) {
6887
- command_1 . issue ( 'warning' , message ) ;
7007
+ command_1 . issue ( 'warning' , message instanceof Error ? message . toString ( ) : message ) ;
6888
7008
}
6889
7009
exports . warning = warning ;
7010
+ /**
7011
+ * Writes info to log with console.log.
7012
+ * @param message info message
7013
+ */
7014
+ function info ( message ) {
7015
+ process . stdout . write ( message + os . EOL ) ;
7016
+ }
7017
+ exports . info = info ;
6890
7018
/**
6891
7019
* Begin an output group.
6892
7020
*
@@ -6927,6 +7055,30 @@ function group(name, fn) {
6927
7055
} ) ;
6928
7056
}
6929
7057
exports . group = group ;
7058
+ //-----------------------------------------------------------------------
7059
+ // Wrapper action state
7060
+ //-----------------------------------------------------------------------
7061
+ /**
7062
+ * Saves state for current action, the state can only be retrieved by this action's post job execution.
7063
+ *
7064
+ * @param name name of the state to store
7065
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
7066
+ */
7067
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
7068
+ function saveState ( name , value ) {
7069
+ command_1 . issueCommand ( 'save-state' , { name } , value ) ;
7070
+ }
7071
+ exports . saveState = saveState ;
7072
+ /**
7073
+ * Gets the value of an state set by this action's main execution.
7074
+ *
7075
+ * @param name name of the state to get
7076
+ * @returns string
7077
+ */
7078
+ function getState ( name ) {
7079
+ return process . env [ `STATE_${ name } ` ] || '' ;
7080
+ }
7081
+ exports . getState = getState ;
6930
7082
//# sourceMappingURL=core.js.map
6931
7083
6932
7084
/***/ } ) ,
0 commit comments