2019-09-14 18:28:16 -04:00
module . exports =
/******/ ( function ( modules , runtime ) { // webpackBootstrap
/******/ "use strict" ;
/******/ // The module cache
/******/ var installedModules = { } ;
/******/
/******/ // The require function
/******/ function _ _webpack _require _ _ ( moduleId ) {
/******/
/******/ // Check if module is in cache
/******/ if ( installedModules [ moduleId ] ) {
/******/ return installedModules [ moduleId ] . exports ;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules [ moduleId ] = {
/******/ i : moduleId ,
/******/ l : false ,
/******/ exports : { }
/******/ } ;
/******/
/******/ // Execute the module function
/******/ modules [ moduleId ] . call ( module . exports , module , module . exports , _ _webpack _require _ _ ) ;
/******/
/******/ // Flag the module as loaded
/******/ module . l = true ;
/******/
/******/ // Return the exports of the module
/******/ return module . exports ;
/******/ }
/******/
/******/
/******/ _ _webpack _require _ _ . ab = _ _dirname + "/" ;
/******/
/******/ // the startup function
/******/ function startup ( ) {
/******/ // Load entry module and return exports
/******/ return _ _webpack _require _ _ ( 104 ) ;
/******/ } ;
/******/
/******/ // run startup
/******/ return startup ( ) ;
/******/ } )
/************************************************************************/
/******/ ( {
2020-10-07 17:06:49 -04:00
/***/ 82 :
/***/ ( function ( _ _unusedmodule , exports ) {
"use strict" ;
// We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
/ * *
* Sanitizes an input into a string so it can be passed into issueCommand safely
* @ param input input to sanitize into a string
* /
function toCommandValue ( input ) {
if ( input === null || input === undefined ) {
return '' ;
}
else if ( typeof input === 'string' || input instanceof String ) {
return input ;
}
return JSON . stringify ( input ) ;
}
exports . toCommandValue = toCommandValue ;
//# sourceMappingURL=utils.js.map
/***/ } ) ,
2019-09-14 18:28:16 -04:00
/***/ 87 :
/***/ ( function ( module ) {
module . exports = require ( "os" ) ;
/***/ } ) ,
2020-10-07 17:06:49 -04:00
/***/ 102 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
// For internal use, subject to change.
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
result [ "default" ] = mod ;
return result ;
} ;
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
// We use any as a valid input type
/* eslint-disable @typescript-eslint/no-explicit-any */
const fs = _ _importStar ( _ _webpack _require _ _ ( 747 ) ) ;
const os = _ _importStar ( _ _webpack _require _ _ ( 87 ) ) ;
const utils _1 = _ _webpack _require _ _ ( 82 ) ;
function issueCommand ( command , message ) {
const filePath = process . env [ ` GITHUB_ ${ command } ` ] ;
if ( ! filePath ) {
throw new Error ( ` Unable to find environment variable for file command ${ command } ` ) ;
}
if ( ! fs . existsSync ( filePath ) ) {
throw new Error ( ` Missing file at path: ${ filePath } ` ) ;
}
fs . appendFileSync ( filePath , ` ${ utils _1 . toCommandValue ( message ) } ${ os . EOL } ` , {
encoding : 'utf8'
} ) ;
}
exports . issueCommand = issueCommand ;
//# sourceMappingURL=file-command.js.map
/***/ } ) ,
2019-09-14 18:28:16 -04:00
/***/ 104 :
/***/ ( function ( _ _unusedmodule , _ _unusedexports , _ _webpack _require _ _ ) {
const core = _ _webpack _require _ _ ( 470 ) ;
const child _process = _ _webpack _require _ _ ( 129 ) ;
const fs = _ _webpack _require _ _ ( 747 ) ;
2021-02-13 15:02:34 -05:00
const os = _ _webpack _require _ _ ( 87 ) ;
2021-02-27 15:47:41 -05:00
const token = _ _webpack _require _ _ ( 417 ) . randomBytes ( 64 ) . toString ( 'hex' ) ;
2019-09-14 18:28:16 -04:00
try {
2020-05-18 03:08:29 -04:00
const privateKey = core . getInput ( 'ssh-private-key' ) ;
2020-01-14 04:29:16 -05:00
if ( ! privateKey ) {
core . setFailed ( "The ssh-private-key argument is empty. Maybe the secret has not been configured, or you are using a wrong secret name in your workflow file." ) ;
return ;
}
2021-02-13 15:02:34 -05:00
var home ;
if ( process . env [ 'OS' ] == 'Windows_NT' ) {
console . log ( 'Preparing ssh-agent service on Windows' ) ;
child _process . execSync ( 'sc config ssh-agent start=demand' , { stdio : 'inherit' } ) ;
home = os . homedir ( ) ;
} else {
// Use getent() system call, since this is what ssh does; makes a difference in Docker-based
// Action runs, where $HOME is different from the pwent
var { homedir : home } = os . userInfo ( ) ;
}
const homeSsh = home + '/.ssh' ;
2019-09-15 03:32:43 -04:00
console . log ( ` Adding GitHub.com keys to ${ homeSsh } /known_hosts ` ) ;
2020-05-18 03:08:29 -04:00
fs . mkdirSync ( homeSsh , { recursive : true } ) ;
2019-09-15 03:32:43 -04:00
fs . appendFileSync ( ` ${ homeSsh } /known_hosts ` , '\ngithub.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==\n' ) ;
fs . appendFileSync ( ` ${ homeSsh } /known_hosts ` , '\ngithub.com ssh-dss AAAAB3NzaC1kc3MAAACBANGFW2P9xlGU3zWrymJgI/lKo//ZW2WfVtmbsUZJ5uyKArtlQOT2+WRhcg4979aFxgKdcsqAYW3/LS1T2km3jYW/vr4Uzn+dXWODVk5VlUiZ1HFOHf6s6ITcZvjvdbp6ZbpM+DuJT7Bw+h5Fx8Qt8I16oCZYmAPJRtu46o9C2zk1AAAAFQC4gdFGcSbp5Gr0Wd5Ay/jtcldMewAAAIATTgn4sY4Nem/FQE+XJlyUQptPWMem5fwOcWtSXiTKaaN0lkk2p2snz+EJvAGXGq9dTSWHyLJSM2W6ZdQDqWJ1k+cL8CARAqL+UMwF84CR0m3hj+wtVGD/J4G5kW2DBAf4/bqzP4469lT+dF2FRQ2L9JKXrCWcnhMtJUvua8dvnwAAAIB6C4nQfAA7x8oLta6tT+oCk2WQcydNsyugE8vLrHlogoWEicla6cWPk7oXSspbzUcfkjN3Qa6e74PhRkc7JdSdAlFzU3m7LMkXo1MHgkqNX8glxWNVqBSc0YRdbFdTkL0C6gtpklilhvuHQCdbgB3LBAikcRkDp+FCVkUgPC/7Rw==\n' ) ;
2019-09-14 18:28:16 -04:00
console . log ( "Starting ssh-agent" ) ;
const authSock = core . getInput ( 'ssh-auth-sock' ) ;
2020-05-18 03:08:29 -04:00
let sshAgentOutput = ''
if ( authSock && authSock . length > 0 ) {
sshAgentOutput = child _process . execFileSync ( 'ssh-agent' , [ '-a' , authSock ] ) ;
} else {
sshAgentOutput = child _process . execFileSync ( 'ssh-agent' )
}
// Extract auth socket path and agent pid and set them as job variables
const lines = sshAgentOutput . toString ( ) . split ( "\n" )
for ( const lineNumber in lines ) {
const matches = /^(SSH_AUTH_SOCK|SSH_AGENT_PID)=(.*); export \1/ . exec ( lines [ lineNumber ] )
if ( matches && matches . length > 0 ) {
core . exportVariable ( matches [ 1 ] , matches [ 2 ] )
}
}
2019-09-14 18:28:16 -04:00
2021-02-27 15:47:41 -05:00
console . log ( "Adding private keys to agent" ) ;
var keyNumber = 0 ;
2020-01-14 04:29:16 -05:00
2021-02-27 15:47:41 -05:00
privateKey . split ( /(?=-----BEGIN)/ ) . forEach ( function ( key ) {
++ keyNumber ;
let keyFile = ` ${ homeSsh } /key_ ${ keyNumber } ` ;
// Write private key (unencrypted!) to file
console . log ( ` Write file ${ keyFile } ` ) ;
fs . writeFileSync ( keyFile , key . replace ( "\r\n" , "\n" ) . trim ( ) + "\n" , { mode : '600' } ) ;
2021-02-28 10:52:09 -05:00
fs . writeFileSync ( ` ${ homeSsh } /askpass ` , ` echo ${ token } ` , { mode : '700' } ) ;
2021-02-27 15:47:41 -05:00
// Set private key passphrase
let output = '' ;
try {
console . log ( ` Set passphrase on ${ keyFile } ` ) ;
output = child _process . execFileSync ( 'ssh-keygen' , [ '-p' , '-f' , keyFile , '-N' , token ] , { stdio : 'inherit' } ) ;
} catch ( exception ) {
fs . unlinkSync ( keyFile ) ;
throw exception ;
}
2020-01-14 04:29:16 -05:00
2021-02-27 15:47:41 -05:00
// Load key into agent
console . log ( 'Load key' ) ;
//let sshAdd = child_process.execSync(`echo "${token}" | ssh-add "${keyFile}"`, { stdio: 'inherit' });
2021-02-28 10:55:23 -05:00
let sshAdd = child _process . execSync ( ` ssh-add ${ keyFile } ` , { stdio : 'inherit' , env : { 'SSH_ASKPASS' : ` ${ homeSsh } /askpass ` } } ) ;
2021-02-27 15:47:41 -05:00
// input: token + "\n", stdio: ['pipe', 'inherit', 'inherit'] });
//sshAdd.stdin.write(token + "\n");
//sshAdd.stdin.end();
2021-02-19 08:37:34 -05:00
2021-02-27 15:47:41 -05:00
output . toString ( ) . split ( /\r?\n/ ) . forEach ( function ( key ) {
let parts = key . match ( /^Key has comment '.*\bgithub\.com[:/]([_.a-z0-9-]+\/[_.a-z0-9-]+?)(?=\.git|\s|\')/ ) ;
2021-02-19 08:37:34 -05:00
2021-02-27 15:47:41 -05:00
if ( parts == null ) {
return ;
}
2021-02-19 08:37:34 -05:00
2021-02-27 15:47:41 -05:00
let ownerAndRepo = parts [ 1 ] ;
2021-02-19 08:37:34 -05:00
2021-02-27 15:47:41 -05:00
child _process . execSync ( ` git config --global --replace-all url."git@key- ${ keyNumber } : ${ ownerAndRepo } ".insteadOf "https://github.com/ ${ ownerAndRepo } " ` ) ;
child _process . execSync ( ` git config --global --add url."git@key- ${ keyNumber } : ${ ownerAndRepo } ".insteadOf "git@github.com: ${ ownerAndRepo } " ` ) ;
child _process . execSync ( ` git config --global --add url."git@key- ${ keyNumber } : ${ ownerAndRepo } ".insteadOf "ssh://git@github.com/ ${ ownerAndRepo } " ` ) ;
2021-02-19 08:37:34 -05:00
2021-02-27 15:47:41 -05:00
// Use IdentitiesOnly=no due to https://github.com/PowerShell/Win32-OpenSSH/issues/1550
let sshConfig = ` \n Host key- ${ keyNumber } \n `
+ ` HostName github.com \n `
+ ` User git \n `
+ ` IdentitiesOnly yes \n `
+ ` IdentityFile ${ keyFile } \n ` ;
2021-02-19 08:37:34 -05:00
2021-02-27 15:47:41 -05:00
fs . appendFileSync ( ` ${ homeSsh } /config ` , sshConfig ) ;
2021-02-19 08:37:34 -05:00
2021-02-27 15:47:41 -05:00
console . log ( ` Added deploy-key mapping: Use key # ${ keyNumber } for GitHub repository ${ ownerAndRepo } ` ) ;
} ) ;
2021-02-19 08:37:34 -05:00
} ) ;
2021-02-27 15:47:41 -05:00
console . log ( "Keys added:" ) ;
child _process . execSync ( 'ssh-add -l' , { stdio : 'inherit' } ) ;
2019-09-14 18:28:16 -04:00
} catch ( error ) {
core . setFailed ( error . message ) ;
}
/***/ } ) ,
/***/ 129 :
/***/ ( function ( module ) {
module . exports = require ( "child_process" ) ;
/***/ } ) ,
2021-02-19 08:37:34 -05:00
/***/ 417 :
/***/ ( function ( module ) {
module . exports = require ( "crypto" ) ;
/***/ } ) ,
2019-09-14 18:28:16 -04:00
/***/ 431 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
2020-06-24 02:31:28 -04:00
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
result [ "default" ] = mod ;
return result ;
} ;
2019-09-14 18:28:16 -04:00
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
2020-06-24 02:31:28 -04:00
const os = _ _importStar ( _ _webpack _require _ _ ( 87 ) ) ;
2020-10-07 17:06:49 -04:00
const utils _1 = _ _webpack _require _ _ ( 82 ) ;
2019-09-14 18:28:16 -04:00
/ * *
* Commands
*
* Command Format :
2020-06-24 02:31:28 -04:00
* : : name key = value , key = value : : message
2019-09-14 18:28:16 -04:00
*
* Examples :
2020-06-24 02:31:28 -04:00
* : : warning : : This is the message
* : : set - env name = MY _VAR : : some value
2019-09-14 18:28:16 -04:00
* /
function issueCommand ( command , properties , message ) {
const cmd = new Command ( command , properties , message ) ;
process . stdout . write ( cmd . toString ( ) + os . EOL ) ;
}
exports . issueCommand = issueCommand ;
function issue ( name , message = '' ) {
issueCommand ( name , { } , message ) ;
}
exports . issue = issue ;
2020-06-24 02:31:28 -04:00
const CMD _STRING = '::' ;
2019-09-14 18:28:16 -04:00
class Command {
constructor ( command , properties , message ) {
if ( ! command ) {
command = 'missing.command' ;
}
this . command = command ;
this . properties = properties ;
this . message = message ;
}
toString ( ) {
2020-06-24 02:31:28 -04:00
let cmdStr = CMD _STRING + this . command ;
2019-09-14 18:28:16 -04:00
if ( this . properties && Object . keys ( this . properties ) . length > 0 ) {
cmdStr += ' ' ;
2020-06-24 02:31:28 -04:00
let first = true ;
2019-09-14 18:28:16 -04:00
for ( const key in this . properties ) {
if ( this . properties . hasOwnProperty ( key ) ) {
const val = this . properties [ key ] ;
if ( val ) {
2020-06-24 02:31:28 -04:00
if ( first ) {
first = false ;
}
else {
cmdStr += ',' ;
}
cmdStr += ` ${ key } = ${ escapeProperty ( val ) } ` ;
2019-09-14 18:28:16 -04:00
}
}
}
}
2020-06-24 02:31:28 -04:00
cmdStr += ` ${ CMD _STRING } ${ escapeData ( this . message ) } ` ;
2019-09-14 18:28:16 -04:00
return cmdStr ;
}
}
function escapeData ( s ) {
2020-10-07 17:06:49 -04:00
return utils _1 . toCommandValue ( s )
2020-06-24 02:31:28 -04:00
. replace ( /%/g , '%25' )
. replace ( /\r/g , '%0D' )
. replace ( /\n/g , '%0A' ) ;
2019-09-14 18:28:16 -04:00
}
2020-06-24 02:31:28 -04:00
function escapeProperty ( s ) {
2020-10-07 17:06:49 -04:00
return utils _1 . toCommandValue ( s )
2020-06-24 02:31:28 -04:00
. replace ( /%/g , '%25' )
2019-09-14 18:28:16 -04:00
. replace ( /\r/g , '%0D' )
. replace ( /\n/g , '%0A' )
2020-06-24 02:31:28 -04:00
. replace ( /:/g , '%3A' )
. replace ( /,/g , '%2C' ) ;
2019-09-14 18:28:16 -04:00
}
//# sourceMappingURL=command.js.map
/***/ } ) ,
/***/ 470 :
/***/ ( function ( _ _unusedmodule , exports , _ _webpack _require _ _ ) {
"use strict" ;
var _ _awaiter = ( this && this . _ _awaiter ) || function ( thisArg , _arguments , P , generator ) {
function adopt ( value ) { return value instanceof P ? value : new P ( function ( resolve ) { resolve ( value ) ; } ) ; }
return new ( P || ( P = Promise ) ) ( function ( resolve , reject ) {
function fulfilled ( value ) { try { step ( generator . next ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function rejected ( value ) { try { step ( generator [ "throw" ] ( value ) ) ; } catch ( e ) { reject ( e ) ; } }
function step ( result ) { result . done ? resolve ( result . value ) : adopt ( result . value ) . then ( fulfilled , rejected ) ; }
step ( ( generator = generator . apply ( thisArg , _arguments || [ ] ) ) . next ( ) ) ;
} ) ;
} ;
2020-06-24 02:31:28 -04:00
var _ _importStar = ( this && this . _ _importStar ) || function ( mod ) {
if ( mod && mod . _ _esModule ) return mod ;
var result = { } ;
if ( mod != null ) for ( var k in mod ) if ( Object . hasOwnProperty . call ( mod , k ) ) result [ k ] = mod [ k ] ;
result [ "default" ] = mod ;
return result ;
} ;
2019-09-14 18:28:16 -04:00
Object . defineProperty ( exports , "__esModule" , { value : true } ) ;
const command _1 = _ _webpack _require _ _ ( 431 ) ;
2020-10-07 17:06:49 -04:00
const file _command _1 = _ _webpack _require _ _ ( 102 ) ;
const utils _1 = _ _webpack _require _ _ ( 82 ) ;
2020-06-24 02:31:28 -04:00
const os = _ _importStar ( _ _webpack _require _ _ ( 87 ) ) ;
const path = _ _importStar ( _ _webpack _require _ _ ( 622 ) ) ;
2019-09-14 18:28:16 -04:00
/ * *
* The code to exit an action
* /
var ExitCode ;
( function ( ExitCode ) {
/ * *
* A code indicating that the action was successful
* /
ExitCode [ ExitCode [ "Success" ] = 0 ] = "Success" ;
/ * *
* A code indicating that the action was a failure
* /
ExitCode [ ExitCode [ "Failure" ] = 1 ] = "Failure" ;
} ) ( ExitCode = exports . ExitCode || ( exports . ExitCode = { } ) ) ;
//-----------------------------------------------------------------------
// Variables
//-----------------------------------------------------------------------
/ * *
2020-06-24 02:31:28 -04:00
* Sets env variable for this action and future actions in the job
2019-09-14 18:28:16 -04:00
* @ param name the name of the variable to set
2020-06-24 02:31:28 -04:00
* @ param val the value of the variable . Non - string values will be converted to a string via JSON . stringify
2019-09-14 18:28:16 -04:00
* /
2020-06-24 02:31:28 -04:00
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2019-09-14 18:28:16 -04:00
function exportVariable ( name , val ) {
2020-10-07 17:06:49 -04:00
const convertedVal = utils _1 . toCommandValue ( val ) ;
2020-06-24 02:31:28 -04:00
process . env [ name ] = convertedVal ;
2020-10-07 17:06:49 -04:00
const filePath = process . env [ 'GITHUB_ENV' ] || '' ;
if ( filePath ) {
const delimiter = '_GitHubActionsFileCommandDelimeter_' ;
const commandValue = ` ${ name } << ${ delimiter } ${ os . EOL } ${ convertedVal } ${ os . EOL } ${ delimiter } ` ;
file _command _1 . issueCommand ( 'ENV' , commandValue ) ;
}
else {
command _1 . issueCommand ( 'set-env' , { name } , convertedVal ) ;
}
2019-09-14 18:28:16 -04:00
}
exports . exportVariable = exportVariable ;
/ * *
2020-06-24 02:31:28 -04:00
* Registers a secret which will get masked from logs
* @ param secret value of the secret
2019-09-14 18:28:16 -04:00
* /
2020-06-24 02:31:28 -04:00
function setSecret ( secret ) {
command _1 . issueCommand ( 'add-mask' , { } , secret ) ;
2019-09-14 18:28:16 -04:00
}
2020-06-24 02:31:28 -04:00
exports . setSecret = setSecret ;
2019-09-14 18:28:16 -04:00
/ * *
* Prepends inputPath to the PATH ( for this action and future actions )
* @ param inputPath
* /
function addPath ( inputPath ) {
2020-10-07 17:06:49 -04:00
const filePath = process . env [ 'GITHUB_PATH' ] || '' ;
if ( filePath ) {
file _command _1 . issueCommand ( 'PATH' , inputPath ) ;
}
else {
command _1 . issueCommand ( 'add-path' , { } , inputPath ) ;
}
2019-09-14 18:28:16 -04:00
process . env [ 'PATH' ] = ` ${ inputPath } ${ path . delimiter } ${ process . env [ 'PATH' ] } ` ;
}
exports . addPath = addPath ;
/ * *
* Gets the value of an input . The value is also trimmed .
*
* @ param name name of the input to get
* @ param options optional . See InputOptions .
* @ returns string
* /
function getInput ( name , options ) {
2020-06-24 02:31:28 -04:00
const val = process . env [ ` INPUT_ ${ name . replace ( / /g , '_' ) . toUpperCase ( ) } ` ] || '' ;
2019-09-14 18:28:16 -04:00
if ( options && options . required && ! val ) {
throw new Error ( ` Input required and not supplied: ${ name } ` ) ;
}
return val . trim ( ) ;
}
exports . getInput = getInput ;
/ * *
* Sets the value of an output .
*
* @ param name name of the output to set
2020-06-24 02:31:28 -04:00
* @ param value value to store . Non - string values will be converted to a string via JSON . stringify
2019-09-14 18:28:16 -04:00
* /
2020-06-24 02:31:28 -04:00
// eslint-disable-next-line @typescript-eslint/no-explicit-any
2019-09-14 18:28:16 -04:00
function setOutput ( name , value ) {
command _1 . issueCommand ( 'set-output' , { name } , value ) ;
}
exports . setOutput = setOutput ;
2020-06-24 02:31:28 -04:00
/ * *
* Enables or disables the echoing of commands into stdout for the rest of the step .
* Echoing is disabled by default if ACTIONS _STEP _DEBUG is not set .
*
* /
function setCommandEcho ( enabled ) {
command _1 . issue ( 'echo' , enabled ? 'on' : 'off' ) ;
}
exports . setCommandEcho = setCommandEcho ;
2019-09-14 18:28:16 -04:00
//-----------------------------------------------------------------------
// Results
//-----------------------------------------------------------------------
/ * *
* Sets the action status to failed .
* When the action exits it will be with an exit code of 1
* @ param message add error issue message
* /
function setFailed ( message ) {
process . exitCode = ExitCode . Failure ;
error ( message ) ;
}
exports . setFailed = setFailed ;
//-----------------------------------------------------------------------
// Logging Commands
//-----------------------------------------------------------------------
2020-06-24 02:31:28 -04:00
/ * *
* Gets whether Actions Step Debug is on or not
* /
function isDebug ( ) {
return process . env [ 'RUNNER_DEBUG' ] === '1' ;
}
exports . isDebug = isDebug ;
2019-09-14 18:28:16 -04:00
/ * *
* Writes debug message to user log
* @ param message debug message
* /
function debug ( message ) {
command _1 . issueCommand ( 'debug' , { } , message ) ;
}
exports . debug = debug ;
/ * *
* Adds an error issue
2020-06-24 02:31:28 -04:00
* @ param message error issue message . Errors will be converted to string via toString ( )
2019-09-14 18:28:16 -04:00
* /
function error ( message ) {
2020-06-24 02:31:28 -04:00
command _1 . issue ( 'error' , message instanceof Error ? message . toString ( ) : message ) ;
2019-09-14 18:28:16 -04:00
}
exports . error = error ;
/ * *
* Adds an warning issue
2020-06-24 02:31:28 -04:00
* @ param message warning issue message . Errors will be converted to string via toString ( )
2019-09-14 18:28:16 -04:00
* /
function warning ( message ) {
2020-06-24 02:31:28 -04:00
command _1 . issue ( 'warning' , message instanceof Error ? message . toString ( ) : message ) ;
2019-09-14 18:28:16 -04:00
}
exports . warning = warning ;
2020-06-24 02:31:28 -04:00
/ * *
* Writes info to log with console . log .
* @ param message info message
* /
function info ( message ) {
process . stdout . write ( message + os . EOL ) ;
}
exports . info = info ;
2019-09-14 18:28:16 -04:00
/ * *
* Begin an output group .
*
* Output until the next ` groupEnd ` will be foldable in this group
*
* @ param name The name of the output group
* /
function startGroup ( name ) {
command _1 . issue ( 'group' , name ) ;
}
exports . startGroup = startGroup ;
/ * *
* End an output group .
* /
function endGroup ( ) {
command _1 . issue ( 'endgroup' ) ;
}
exports . endGroup = endGroup ;
/ * *
* Wrap an asynchronous function call in a group .
*
* Returns the same type as the function itself .
*
* @ param name The name of the group
* @ param fn The function to wrap in the group
* /
function group ( name , fn ) {
return _ _awaiter ( this , void 0 , void 0 , function * ( ) {
startGroup ( name ) ;
let result ;
try {
result = yield fn ( ) ;
}
finally {
endGroup ( ) ;
}
return result ;
} ) ;
}
exports . group = group ;
2020-06-24 02:31:28 -04:00
//-----------------------------------------------------------------------
// Wrapper action state
//-----------------------------------------------------------------------
/ * *
* Saves state for current action , the state can only be retrieved by this action ' s post job execution .
*
* @ param name name of the state to store
* @ param value value to store . Non - string values will be converted to a string via JSON . stringify
* /
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function saveState ( name , value ) {
command _1 . issueCommand ( 'save-state' , { name } , value ) ;
}
exports . saveState = saveState ;
/ * *
* Gets the value of an state set by this action ' s main execution .
*
* @ param name name of the state to get
* @ returns string
* /
function getState ( name ) {
return process . env [ ` STATE_ ${ name } ` ] || '' ;
}
exports . getState = getState ;
2019-09-14 18:28:16 -04:00
//# sourceMappingURL=core.js.map
/***/ } ) ,
/***/ 622 :
/***/ ( function ( module ) {
module . exports = require ( "path" ) ;
/***/ } ) ,
/***/ 747 :
/***/ ( function ( module ) {
module . exports = require ( "fs" ) ;
/***/ } )
/******/ } ) ;