@@ -1999,6 +1999,32 @@ const windowsRelease = release => {
1999
1999
module . exports = windowsRelease ;
2000
2000
2001
2001
2002
+ /***/ } ) ,
2003
+
2004
+ /***/ 82 :
2005
+ /***/ ( function ( __unusedmodule , exports ) {
2006
+
2007
+ "use strict" ;
2008
+
2009
+ // We use any as a valid input type
2010
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2011
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
2012
+ /**
2013
+ * Sanitizes an input into a string so it can be passed into issueCommand safely
2014
+ * @param input input to sanitize into a string
2015
+ */
2016
+ function toCommandValue ( input ) {
2017
+ if ( input === null || input === undefined ) {
2018
+ return '' ;
2019
+ }
2020
+ else if ( typeof input === 'string' || input instanceof String ) {
2021
+ return input ;
2022
+ }
2023
+ return JSON . stringify ( input ) ;
2024
+ }
2025
+ exports . toCommandValue = toCommandValue ;
2026
+ //# sourceMappingURL=utils.js.map
2027
+
2002
2028
/***/ } ) ,
2003
2029
2004
2030
/***/ 87 :
@@ -2008,6 +2034,42 @@ module.exports = require("os");
2008
2034
2009
2035
/***/ } ) ,
2010
2036
2037
+ /***/ 102 :
2038
+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
2039
+
2040
+ "use strict" ;
2041
+
2042
+ // For internal use, subject to change.
2043
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
2044
+ if ( mod && mod . __esModule ) return mod ;
2045
+ var result = { } ;
2046
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
2047
+ result [ "default" ] = mod ;
2048
+ return result ;
2049
+ } ;
2050
+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
2051
+ // We use any as a valid input type
2052
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2053
+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
2054
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
2055
+ const utils_1 = __webpack_require__ ( 82 ) ;
2056
+ function issueCommand ( command , message ) {
2057
+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
2058
+ if ( ! filePath ) {
2059
+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
2060
+ }
2061
+ if ( ! fs . existsSync ( filePath ) ) {
2062
+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
2063
+ }
2064
+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
2065
+ encoding : 'utf8'
2066
+ } ) ;
2067
+ }
2068
+ exports . issueCommand = issueCommand ;
2069
+ //# sourceMappingURL=file-command.js.map
2070
+
2071
+ /***/ } ) ,
2072
+
2011
2073
/***/ 104 :
2012
2074
/***/ ( function ( __unusedmodule , __unusedexports , __webpack_require__ ) {
2013
2075
@@ -2021,6 +2083,7 @@ const main = async () => {
2021
2083
const token = core . getInput ( 'github-token' )
2022
2084
const branch = core . getInput ( 'branch' )
2023
2085
const base = core . getInput ( 'base' )
2086
+ const author = core . getInput ( 'author' )
2024
2087
2025
2088
const query = {
2026
2089
...context . repo ,
@@ -2037,7 +2100,9 @@ const main = async () => {
2037
2100
const octokit = new GitHub ( token )
2038
2101
2039
2102
const res = await octokit . pulls . list ( query )
2040
- const pr = res . data . length && res . data [ 0 ]
2103
+ const pr = author
2104
+ ? res . data . length && res . data . filter ( pr => pr . user . login === author ) [ 0 ]
2105
+ : res . data . length && res . data [ 0 ]
2041
2106
2042
2107
core . debug ( `pr: ${ JSON . stringify ( pr , null , 2 ) } ` )
2043
2108
core . setOutput ( 'number' , pr ? pr . number : '' )
@@ -4734,17 +4799,25 @@ function octokitValidate(octokit) {
4734
4799
4735
4800
"use strict" ;
4736
4801
4802
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
4803
+ if ( mod && mod . __esModule ) return mod ;
4804
+ var result = { } ;
4805
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
4806
+ result [ "default" ] = mod ;
4807
+ return result ;
4808
+ } ;
4737
4809
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
4738
- const os = __webpack_require__ ( 87 ) ;
4810
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
4811
+ const utils_1 = __webpack_require__ ( 82 ) ;
4739
4812
/**
4740
4813
* Commands
4741
4814
*
4742
4815
* Command Format:
4743
- * ##[ name key=value; key=value] message
4816
+ * :: name key=value, key=value:: message
4744
4817
*
4745
4818
* Examples:
4746
- * ##[ warning] This is the user warning message
4747
- * ##[ set-secret name=mypassword]definitelyNotAPassword!
4819
+ * :: warning:: This is the message
4820
+ * :: set-env name=MY_VAR::some value
4748
4821
*/
4749
4822
function issueCommand ( command , properties , message ) {
4750
4823
const cmd = new Command ( command , properties , message ) ;
@@ -4769,34 +4842,39 @@ class Command {
4769
4842
let cmdStr = CMD_STRING + this . command ;
4770
4843
if ( this . properties && Object . keys ( this . properties ) . length > 0 ) {
4771
4844
cmdStr += ' ' ;
4845
+ let first = true ;
4772
4846
for ( const key in this . properties ) {
4773
4847
if ( this . properties . hasOwnProperty ( key ) ) {
4774
4848
const val = this . properties [ key ] ;
4775
4849
if ( val ) {
4776
- // safely append the val - avoid blowing up when attempting to
4777
- // call .replace() if message is not a string for some reason
4778
- cmdStr += `${ key } =${ escape ( `${ val || '' } ` ) } ,` ;
4850
+ if ( first ) {
4851
+ first = false ;
4852
+ }
4853
+ else {
4854
+ cmdStr += ',' ;
4855
+ }
4856
+ cmdStr += `${ key } =${ escapeProperty ( val ) } ` ;
4779
4857
}
4780
4858
}
4781
4859
}
4782
4860
}
4783
- cmdStr += CMD_STRING ;
4784
- // safely append the message - avoid blowing up when attempting to
4785
- // call .replace() if message is not a string for some reason
4786
- const message = `${ this . message || '' } ` ;
4787
- cmdStr += escapeData ( message ) ;
4861
+ cmdStr += `${ CMD_STRING } ${ escapeData ( this . message ) } ` ;
4788
4862
return cmdStr ;
4789
4863
}
4790
4864
}
4791
4865
function escapeData ( s ) {
4792
- return s . replace ( / \r / g, '%0D' ) . replace ( / \n / g, '%0A' ) ;
4866
+ return utils_1 . toCommandValue ( s )
4867
+ . replace ( / % / g, '%25' )
4868
+ . replace ( / \r / g, '%0D' )
4869
+ . replace ( / \n / g, '%0A' ) ;
4793
4870
}
4794
- function escape ( s ) {
4795
- return s
4871
+ function escapeProperty ( s ) {
4872
+ return utils_1 . toCommandValue ( s )
4873
+ . replace ( / % / g, '%25' )
4796
4874
. replace ( / \r / g, '%0D' )
4797
4875
. replace ( / \n / g, '%0A' )
4798
- . replace ( / ] / g, '%5D ' )
4799
- . replace ( / ; / g, '%3B ' ) ;
4876
+ . replace ( / : / g, '%3A ' )
4877
+ . replace ( / , / g, '%2C ' ) ;
4800
4878
}
4801
4879
//# sourceMappingURL=command.js.map
4802
4880
@@ -6714,10 +6792,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
6714
6792
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
6715
6793
} ) ;
6716
6794
} ;
6795
+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
6796
+ if ( mod && mod . __esModule ) return mod ;
6797
+ var result = { } ;
6798
+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
6799
+ result [ "default" ] = mod ;
6800
+ return result ;
6801
+ } ;
6717
6802
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
6718
6803
const command_1 = __webpack_require__ ( 431 ) ;
6719
- const os = __webpack_require__ ( 87 ) ;
6720
- const path = __webpack_require__ ( 622 ) ;
6804
+ const file_command_1 = __webpack_require__ ( 102 ) ;
6805
+ const utils_1 = __webpack_require__ ( 82 ) ;
6806
+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
6807
+ const path = __importStar ( __webpack_require__ ( 622 ) ) ;
6721
6808
/**
6722
6809
* The code to exit an action
6723
6810
*/
@@ -6738,11 +6825,21 @@ var ExitCode;
6738
6825
/**
6739
6826
* Sets env variable for this action and future actions in the job
6740
6827
* @param name the name of the variable to set
6741
- * @param val the value of the variable
6828
+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
6742
6829
*/
6830
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6743
6831
function exportVariable ( name , val ) {
6744
- process . env [ name ] = val ;
6745
- command_1 . issueCommand ( 'set-env' , { name } , val ) ;
6832
+ const convertedVal = utils_1 . toCommandValue ( val ) ;
6833
+ process . env [ name ] = convertedVal ;
6834
+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
6835
+ if ( filePath ) {
6836
+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
6837
+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
6838
+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
6839
+ }
6840
+ else {
6841
+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
6842
+ }
6746
6843
}
6747
6844
exports . exportVariable = exportVariable ;
6748
6845
/**
@@ -6758,7 +6855,13 @@ exports.setSecret = setSecret;
6758
6855
* @param inputPath
6759
6856
*/
6760
6857
function addPath ( inputPath ) {
6761
- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
6858
+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
6859
+ if ( filePath ) {
6860
+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
6861
+ }
6862
+ else {
6863
+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
6864
+ }
6762
6865
process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
6763
6866
}
6764
6867
exports . addPath = addPath ;
@@ -6781,12 +6884,22 @@ exports.getInput = getInput;
6781
6884
* Sets the value of an output.
6782
6885
*
6783
6886
* @param name name of the output to set
6784
- * @param value value to store
6887
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
6785
6888
*/
6889
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6786
6890
function setOutput ( name , value ) {
6787
6891
command_1 . issueCommand ( 'set-output' , { name } , value ) ;
6788
6892
}
6789
6893
exports . setOutput = setOutput ;
6894
+ /**
6895
+ * Enables or disables the echoing of commands into stdout for the rest of the step.
6896
+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
6897
+ *
6898
+ */
6899
+ function setCommandEcho ( enabled ) {
6900
+ command_1 . issue ( 'echo' , enabled ? 'on' : 'off' ) ;
6901
+ }
6902
+ exports . setCommandEcho = setCommandEcho ;
6790
6903
//-----------------------------------------------------------------------
6791
6904
// Results
6792
6905
//-----------------------------------------------------------------------
@@ -6803,6 +6916,13 @@ exports.setFailed = setFailed;
6803
6916
//-----------------------------------------------------------------------
6804
6917
// Logging Commands
6805
6918
//-----------------------------------------------------------------------
6919
+ /**
6920
+ * Gets whether Actions Step Debug is on or not
6921
+ */
6922
+ function isDebug ( ) {
6923
+ return process . env [ 'RUNNER_DEBUG' ] === '1' ;
6924
+ }
6925
+ exports . isDebug = isDebug ;
6806
6926
/**
6807
6927
* Writes debug message to user log
6808
6928
* @param message debug message
@@ -6813,18 +6933,18 @@ function debug(message) {
6813
6933
exports . debug = debug ;
6814
6934
/**
6815
6935
* Adds an error issue
6816
- * @param message error issue message
6936
+ * @param message error issue message. Errors will be converted to string via toString()
6817
6937
*/
6818
6938
function error ( message ) {
6819
- command_1 . issue ( 'error' , message ) ;
6939
+ command_1 . issue ( 'error' , message instanceof Error ? message . toString ( ) : message ) ;
6820
6940
}
6821
6941
exports . error = error ;
6822
6942
/**
6823
6943
* Adds an warning issue
6824
- * @param message warning issue message
6944
+ * @param message warning issue message. Errors will be converted to string via toString()
6825
6945
*/
6826
6946
function warning ( message ) {
6827
- command_1 . issue ( 'warning' , message ) ;
6947
+ command_1 . issue ( 'warning' , message instanceof Error ? message . toString ( ) : message ) ;
6828
6948
}
6829
6949
exports . warning = warning ;
6830
6950
/**
@@ -6882,8 +7002,9 @@ exports.group = group;
6882
7002
* Saves state for current action, the state can only be retrieved by this action's post job execution.
6883
7003
*
6884
7004
* @param name name of the state to store
6885
- * @param value value to store
7005
+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
6886
7006
*/
7007
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6887
7008
function saveState ( name , value ) {
6888
7009
command_1 . issueCommand ( 'save-state' , { name } , value ) ;
6889
7010
}
0 commit comments