@@ -13,40 +13,37 @@ import { getActionsLogger } from "./logging";
1313import { checkGitHubVersionInRange , getErrorMessage } from "./util" ;
1414
1515async function runWrapper ( ) {
16+ const logger = getActionsLogger ( ) ;
17+
1618 try {
1719 // Restore inputs from `start-proxy` Action.
1820 actionsUtil . restoreInputs ( ) ;
21+
22+ // Kill the running proxy
1923 const pid = core . getState ( "proxy-process-pid" ) ;
2024 if ( pid ) {
2125 process . kill ( Number ( pid ) ) ;
2226 }
23- } catch ( error ) {
24- core . setFailed (
25- `start-proxy post-action step failed: ${ getErrorMessage ( error ) } ` ,
26- ) ;
27- }
28- const config = await configUtils . getConfig (
29- actionsUtil . getTemporaryDirectory ( ) ,
30- core ,
31- ) ;
3227
33- if ( ( config && config . debugMode ) || core . isDebug ( ) ) {
34- const logFilePath = core . getState ( "proxy-log-file" ) ;
35- core . info (
36- "Debug mode is on. Uploading proxy log as Actions debugging artifact..." ,
28+ const config = await configUtils . getConfig (
29+ actionsUtil . getTemporaryDirectory ( ) ,
30+ logger ,
3731 ) ;
38- if ( config ?. gitHubVersion . type === undefined ) {
39- core . warning (
40- `Did not upload debug artifacts because cannot determine the GitHub variant running.` ,
41- ) ;
42- return ;
43- }
4432
45- const logger = getActionsLogger ( ) ;
46- const gitHubVersion = await getGitHubVersion ( ) ;
47- checkGitHubVersionInRange ( gitHubVersion , logger ) ;
33+ if ( ( config && config . debugMode ) || core . isDebug ( ) ) {
34+ const logFilePath = core . getState ( "proxy-log-file" ) ;
35+ logger . info (
36+ "Debug mode is on. Uploading proxy log as Actions debugging artifact..." ,
37+ ) ;
38+ if ( config ?. gitHubVersion . type === undefined ) {
39+ logger . warning (
40+ `Did not upload debug artifacts because cannot determine the GitHub variant running.` ,
41+ ) ;
42+ return ;
43+ }
44+ const gitHubVersion = await getGitHubVersion ( ) ;
45+ checkGitHubVersionInRange ( gitHubVersion , logger ) ;
4846
49- try {
5047 const artifactUploader = await getArtifactUploaderClient (
5148 logger ,
5249 gitHubVersion . type ,
@@ -61,10 +58,12 @@ async function runWrapper() {
6158 retentionDays : 7 ,
6259 } ,
6360 ) ;
64- } catch ( e ) {
65- // A failure to upload debug artifacts should not fail the entire action.
66- core . warning ( `Failed to upload debug artifacts: ${ e } ` ) ;
6761 }
62+ } catch ( error ) {
63+ // A failure in the post step should not fail the entire action.
64+ logger . warning (
65+ `start-proxy post-action step failed: ${ getErrorMessage ( error ) } ` ,
66+ ) ;
6867 }
6968}
7069
0 commit comments