@@ -624,13 +624,75 @@ class ExecState extends events.EventEmitter {
624624
625625/***/ } ) ,
626626
627+ /***/ 82 :
628+ /***/ ( function ( __unusedmodule , exports ) {
629+
630+ "use strict" ;
631+
632+ // We use any as a valid input type
633+ /* eslint-disable @typescript-eslint/no-explicit-any */
634+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
635+ /**
636+ * Sanitizes an input into a string so it can be passed into issueCommand safely
637+ * @param input input to sanitize into a string
638+ */
639+ function toCommandValue ( input ) {
640+ if ( input === null || input === undefined ) {
641+ return '' ;
642+ }
643+ else if ( typeof input === 'string' || input instanceof String ) {
644+ return input ;
645+ }
646+ return JSON . stringify ( input ) ;
647+ }
648+ exports . toCommandValue = toCommandValue ;
649+ //# sourceMappingURL=utils.js.map
650+
651+ /***/ } ) ,
652+
627653/***/ 87 :
628654/***/ ( function ( module ) {
629655
630656module . exports = require ( "os" ) ;
631657
632658/***/ } ) ,
633659
660+ /***/ 102 :
661+ /***/ ( function ( __unusedmodule , exports , __webpack_require__ ) {
662+
663+ "use strict" ;
664+
665+ // For internal use, subject to change.
666+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
667+ if ( mod && mod . __esModule ) return mod ;
668+ var result = { } ;
669+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
670+ result [ "default" ] = mod ;
671+ return result ;
672+ } ;
673+ Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
674+ // We use any as a valid input type
675+ /* eslint-disable @typescript-eslint/no-explicit-any */
676+ const fs = __importStar ( __webpack_require__ ( 747 ) ) ;
677+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
678+ const utils_1 = __webpack_require__ ( 82 ) ;
679+ function issueCommand ( command , message ) {
680+ const filePath = process . env [ `GITHUB_${ command } ` ] ;
681+ if ( ! filePath ) {
682+ throw new Error ( `Unable to find environment variable for file command ${ command } ` ) ;
683+ }
684+ if ( ! fs . existsSync ( filePath ) ) {
685+ throw new Error ( `Missing file at path: ${ filePath } ` ) ;
686+ }
687+ fs . appendFileSync ( filePath , `${ utils_1 . toCommandValue ( message ) } ${ os . EOL } ` , {
688+ encoding : 'utf8'
689+ } ) ;
690+ }
691+ exports . issueCommand = issueCommand ;
692+ //# sourceMappingURL=file-command.js.map
693+
694+ /***/ } ) ,
695+
634696/***/ 129 :
635697/***/ ( function ( module ) {
636698
@@ -675,7 +737,7 @@ const COLCON_BUNDLE_RETRIES = Number.parseInt(core.getInput('colcon-bundle-retri
675737const MINIMUM_BACKOFF_TIME_SECONDS = 32 ; // delay for the first retry in seconds
676738const MAXIMUM_BACKOFF_TIME_SECONDS = 128 ; // maximum delay for a retry in seconds
677739function delay ( ms ) {
678- return new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
740+ return new Promise ( resolve => setTimeout ( resolve , ms ) ) ;
679741}
680742function loadROSEnvVariables ( ) {
681743 return __awaiter ( this , void 0 , void 0 , function * ( ) {
@@ -769,17 +831,22 @@ function setup() {
769831 return __awaiter ( this , void 0 , void 0 , function * ( ) {
770832 try {
771833 yield exec . exec ( "sudo" , [ "apt-key" , "adv" , "--fetch-keys" , "http://packages.osrfoundation.org/gazebo.key" ] ) ;
772- const aptPackages = [
834+ let aptPackages = [
773835 "zip" ,
774836 "cmake" ,
775837 "lcov" ,
776838 "libgtest-dev" ,
777- "python-pip" ,
778- "python-rosinstall" ,
779839 "python3-colcon-common-extensions" ,
840+ "python3-apt" ,
780841 "python3-pip" ,
781- " python3-apt"
842+ ( ROS_DISTRO == "foxy" ) ? " python3-rosinstall" : "python-rosinstall" ,
782843 ] ;
844+ if ( ROS_DISTRO != "foxy" ) {
845+ //focal (foxy) does not ship with python2 and does not require python-pip
846+ //using the ros_distro instead of ubuntu_distro saves users from specifying another
847+ //essentially redundant parameter.
848+ aptPackages = aptPackages . concat ( [ "python-pip" ] ) ;
849+ }
783850 const python3Packages = [
784851 "setuptools" ,
785852 "colcon-bundle" ,
@@ -801,12 +868,12 @@ function setup() {
801868 }
802869 } ) ;
803870}
804- function setup_gazebo9 ( ) {
871+ function setup_gazebo_source ( ) {
805872 return __awaiter ( this , void 0 , void 0 , function * ( ) {
806873 try {
807- const gazebo9_apt_file = "/etc/apt/sources.list.d/gazebo-stable.list" ;
808- yield exec . exec ( "sudo" , [ "rm" , "-f" , gazebo9_apt_file ] ) ;
809- yield exec . exec ( "bash" , [ "-c" , `echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable \`lsb_release -cs\` main" | sudo tee ${ gazebo9_apt_file } ` ] ) ;
874+ const gazebo_apt_file = "/etc/apt/sources.list.d/gazebo-stable.list" ;
875+ yield exec . exec ( "sudo" , [ "rm" , "-f" , gazebo_apt_file ] ) ;
876+ yield exec . exec ( "bash" , [ "-c" , `echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable \`lsb_release -cs\` main" | sudo tee ${ gazebo_apt_file } ` ] ) ;
810877 yield exec . exec ( "sudo" , [ "apt-get" , "update" ] ) ;
811878 if ( ROS_DISTRO == "kinetic" ) {
812879 const gazebo9_rosdep_file = "/etc/ros/rosdep/sources.list.d/00-gazebo9.list" ;
@@ -865,11 +932,12 @@ function bundle() {
865932 const bundleFilename = path . basename ( WORKSPACE_DIRECTORY ) ;
866933 yield exec . exec ( "colcon" , [ "bundle" , "--build-base" , "build" , "--install-base" , "install" , "--bundle-base" , "bundle" ] , getWorkingDirExecOptions ( ) ) ;
867934 yield exec . exec ( "mv" , [ "bundle/output.tar" , `../${ bundleFilename } .tar` ] , getWorkingDirExecOptions ( ) ) ;
868- yield exec . exec ( "rm" , [ "-rf" , "bundle" ] , getWorkingDirExecOptions ( ) ) ; // github actions have been failing with no disk space
935+ yield exec . exec ( "rm" , [ "-rf" , "bundle" ] , getWorkingDirExecOptions ( ) ) ; // github actions have been failing with no disk space
869936 break ; // break if colcon bundle passes
870- } catch ( error ) {
937+ }
938+ catch ( error ) {
871939 yield exec . exec ( "rm" , [ "-rf" , "bundle" ] , getWorkingDirExecOptions ( ) ) ; // remove erred bundle assets
872- if ( i == COLCON_BUNDLE_RETRIES ) {
940+ if ( i == COLCON_BUNDLE_RETRIES ) {
873941 core . setFailed ( error . message ) ; // set action to Failed if the colcon bundle fails even after COLCON_BUNDLE_RETRIES number of retries
874942 break ;
875943 }
@@ -887,24 +955,28 @@ function run() {
887955 console . log ( `WORKSPACE_DIRECTORY: ${ WORKSPACE_DIRECTORY } ` ) ;
888956 console . log ( `GENERATE_SOURCES: ${ GENERATE_SOURCES } ` ) ;
889957 console . log ( `COLCON_BUNDLE_RETRIES: ${ COLCON_BUNDLE_RETRIES } ` ) ;
890- // check if COLCON_BUNDLE_RETRIES is valid (i.e. 0<) and not too large (i.e. <10)
891- if ( COLCON_BUNDLE_RETRIES < 0 || 9 < COLCON_BUNDLE_RETRIES ) {
958+ // check if COLCON_BUNDLE_RETRIES is valid (i.e. 0<) and not too large (i.e. <10)
959+ if ( COLCON_BUNDLE_RETRIES < 0 || 9 < COLCON_BUNDLE_RETRIES ) {
892960 core . setFailed ( `Invalid number of colcon bundle retries. Must be between 0-9 inclusive` ) ;
893961 }
894962 yield setup ( ) ;
895963 if ( ROS_DISTRO == "kinetic" && ( GAZEBO_VERSION == "" || GAZEBO_VERSION == "7" ) ) {
896964 GAZEBO_VERSION = "7" ;
897965 }
898966 else if ( ROS_DISTRO == "kinetic" && GAZEBO_VERSION == "9" ) {
899- yield setup_gazebo9 ( ) ;
967+ yield setup_gazebo_source ( ) ;
900968 }
901969 else if ( ROS_DISTRO == "melodic" && ( GAZEBO_VERSION == "" || GAZEBO_VERSION == "9" ) ) {
902970 GAZEBO_VERSION = "9" ;
903- yield setup_gazebo9 ( ) ;
971+ yield setup_gazebo_source ( ) ;
904972 }
905973 else if ( ROS_DISTRO == "dashing" && ( GAZEBO_VERSION == "" || GAZEBO_VERSION == "9" ) ) {
906974 GAZEBO_VERSION = "9" ;
907- yield setup_gazebo9 ( ) ;
975+ yield setup_gazebo_source ( ) ;
976+ }
977+ else if ( ROS_DISTRO == "foxy" && ( GAZEBO_VERSION == "" || GAZEBO_VERSION == "11" ) ) {
978+ GAZEBO_VERSION = "11" ;
979+ yield setup_gazebo_source ( ) ;
908980 }
909981 else {
910982 core . setFailed ( `Invalid ROS and Gazebo combination` ) ;
@@ -929,17 +1001,25 @@ run();
9291001
9301002"use strict" ;
9311003
1004+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1005+ if ( mod && mod . __esModule ) return mod ;
1006+ var result = { } ;
1007+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1008+ result [ "default" ] = mod ;
1009+ return result ;
1010+ } ;
9321011Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
933- const os = __webpack_require__ ( 87 ) ;
1012+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1013+ const utils_1 = __webpack_require__ ( 82 ) ;
9341014/**
9351015 * Commands
9361016 *
9371017 * Command Format:
938- * ##[ name key=value; key=value] message
1018+ * :: name key=value, key=value:: message
9391019 *
9401020 * Examples:
941- * ##[ warning] This is the user warning message
942- * ##[ set-secret name=mypassword]definitelyNotAPassword!
1021+ * :: warning:: This is the message
1022+ * :: set-env name=MY_VAR::some value
9431023 */
9441024function issueCommand ( command , properties , message ) {
9451025 const cmd = new Command ( command , properties , message ) ;
@@ -964,34 +1044,39 @@ class Command {
9641044 let cmdStr = CMD_STRING + this . command ;
9651045 if ( this . properties && Object . keys ( this . properties ) . length > 0 ) {
9661046 cmdStr += ' ' ;
1047+ let first = true ;
9671048 for ( const key in this . properties ) {
9681049 if ( this . properties . hasOwnProperty ( key ) ) {
9691050 const val = this . properties [ key ] ;
9701051 if ( val ) {
971- // safely append the val - avoid blowing up when attempting to
972- // call .replace() if message is not a string for some reason
973- cmdStr += `${ key } =${ escape ( `${ val || '' } ` ) } ,` ;
1052+ if ( first ) {
1053+ first = false ;
1054+ }
1055+ else {
1056+ cmdStr += ',' ;
1057+ }
1058+ cmdStr += `${ key } =${ escapeProperty ( val ) } ` ;
9741059 }
9751060 }
9761061 }
9771062 }
978- cmdStr += CMD_STRING ;
979- // safely append the message - avoid blowing up when attempting to
980- // call .replace() if message is not a string for some reason
981- const message = `${ this . message || '' } ` ;
982- cmdStr += escapeData ( message ) ;
1063+ cmdStr += `${ CMD_STRING } ${ escapeData ( this . message ) } ` ;
9831064 return cmdStr ;
9841065 }
9851066}
9861067function escapeData ( s ) {
987- return s . replace ( / \r / g, '%0D' ) . replace ( / \n / g, '%0A' ) ;
1068+ return utils_1 . toCommandValue ( s )
1069+ . replace ( / % / g, '%25' )
1070+ . replace ( / \r / g, '%0D' )
1071+ . replace ( / \n / g, '%0A' ) ;
9881072}
989- function escape ( s ) {
990- return s
1073+ function escapeProperty ( s ) {
1074+ return utils_1 . toCommandValue ( s )
1075+ . replace ( / % / g, '%25' )
9911076 . replace ( / \r / g, '%0D' )
9921077 . replace ( / \n / g, '%0A' )
993- . replace ( / ] / g, '%5D ' )
994- . replace ( / ; / g, '%3B ' ) ;
1078+ . replace ( / : / g, '%3A ' )
1079+ . replace ( / , / g, '%2C ' ) ;
9951080}
9961081//# sourceMappingURL=command.js.map
9971082
@@ -1011,10 +1096,19 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10111096 step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
10121097 } ) ;
10131098} ;
1099+ var __importStar = ( this && this . __importStar ) || function ( mod ) {
1100+ if ( mod && mod . __esModule ) return mod ;
1101+ var result = { } ;
1102+ if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
1103+ result [ "default" ] = mod ;
1104+ return result ;
1105+ } ;
10141106Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
10151107const command_1 = __webpack_require__ ( 431 ) ;
1016- const os = __webpack_require__ ( 87 ) ;
1017- const path = __webpack_require__ ( 622 ) ;
1108+ const file_command_1 = __webpack_require__ ( 102 ) ;
1109+ const utils_1 = __webpack_require__ ( 82 ) ;
1110+ const os = __importStar ( __webpack_require__ ( 87 ) ) ;
1111+ const path = __importStar ( __webpack_require__ ( 622 ) ) ;
10181112/**
10191113 * The code to exit an action
10201114 */
@@ -1035,11 +1129,21 @@ var ExitCode;
10351129/**
10361130 * Sets env variable for this action and future actions in the job
10371131 * @param name the name of the variable to set
1038- * @param val the value of the variable
1132+ * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify
10391133 */
1134+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10401135function exportVariable ( name , val ) {
1041- process . env [ name ] = val ;
1042- command_1 . issueCommand ( 'set-env' , { name } , val ) ;
1136+ const convertedVal = utils_1 . toCommandValue ( val ) ;
1137+ process . env [ name ] = convertedVal ;
1138+ const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
1139+ if ( filePath ) {
1140+ const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
1141+ const commandValue = `${ name } <<${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
1142+ file_command_1 . issueCommand ( 'ENV' , commandValue ) ;
1143+ }
1144+ else {
1145+ command_1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
1146+ }
10431147}
10441148exports . exportVariable = exportVariable ;
10451149/**
@@ -1055,7 +1159,13 @@ exports.setSecret = setSecret;
10551159 * @param inputPath
10561160 */
10571161function addPath ( inputPath ) {
1058- command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
1162+ const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
1163+ if ( filePath ) {
1164+ file_command_1 . issueCommand ( 'PATH' , inputPath ) ;
1165+ }
1166+ else {
1167+ command_1 . issueCommand ( 'add-path' , { } , inputPath ) ;
1168+ }
10591169 process . env [ 'PATH' ] = `${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
10601170}
10611171exports . addPath = addPath ;
@@ -1078,12 +1188,22 @@ exports.getInput = getInput;
10781188 * Sets the value of an output.
10791189 *
10801190 * @param name name of the output to set
1081- * @param value value to store
1191+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
10821192 */
1193+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10831194function setOutput ( name , value ) {
10841195 command_1 . issueCommand ( 'set-output' , { name } , value ) ;
10851196}
10861197exports . setOutput = setOutput ;
1198+ /**
1199+ * Enables or disables the echoing of commands into stdout for the rest of the step.
1200+ * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.
1201+ *
1202+ */
1203+ function setCommandEcho ( enabled ) {
1204+ command_1 . issue ( 'echo' , enabled ? 'on' : 'off' ) ;
1205+ }
1206+ exports . setCommandEcho = setCommandEcho ;
10871207//-----------------------------------------------------------------------
10881208// Results
10891209//-----------------------------------------------------------------------
@@ -1100,6 +1220,13 @@ exports.setFailed = setFailed;
11001220//-----------------------------------------------------------------------
11011221// Logging Commands
11021222//-----------------------------------------------------------------------
1223+ /**
1224+ * Gets whether Actions Step Debug is on or not
1225+ */
1226+ function isDebug ( ) {
1227+ return process . env [ 'RUNNER_DEBUG' ] === '1' ;
1228+ }
1229+ exports . isDebug = isDebug ;
11031230/**
11041231 * Writes debug message to user log
11051232 * @param message debug message
@@ -1110,18 +1237,18 @@ function debug(message) {
11101237exports . debug = debug ;
11111238/**
11121239 * Adds an error issue
1113- * @param message error issue message
1240+ * @param message error issue message. Errors will be converted to string via toString()
11141241 */
11151242function error ( message ) {
1116- command_1 . issue ( 'error' , message ) ;
1243+ command_1 . issue ( 'error' , message instanceof Error ? message . toString ( ) : message ) ;
11171244}
11181245exports . error = error ;
11191246/**
11201247 * Adds an warning issue
1121- * @param message warning issue message
1248+ * @param message warning issue message. Errors will be converted to string via toString()
11221249 */
11231250function warning ( message ) {
1124- command_1 . issue ( 'warning' , message ) ;
1251+ command_1 . issue ( 'warning' , message instanceof Error ? message . toString ( ) : message ) ;
11251252}
11261253exports . warning = warning ;
11271254/**
@@ -1179,8 +1306,9 @@ exports.group = group;
11791306 * Saves state for current action, the state can only be retrieved by this action's post job execution.
11801307 *
11811308 * @param name name of the state to store
1182- * @param value value to store
1309+ * @param value value to store. Non-string values will be converted to a string via JSON.stringify
11831310 */
1311+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
11841312function saveState ( name , value ) {
11851313 command_1 . issueCommand ( 'save-state' , { name } , value ) ;
11861314}
0 commit comments