@@ -13,40 +13,37 @@ import { getActionsLogger } from "./logging";
13
13
import { checkGitHubVersionInRange , getErrorMessage } from "./util" ;
14
14
15
15
async function runWrapper ( ) {
16
+ const logger = getActionsLogger ( ) ;
17
+
16
18
try {
17
19
// Restore inputs from `start-proxy` Action.
18
20
actionsUtil . restoreInputs ( ) ;
21
+
22
+ // Kill the running proxy
19
23
const pid = core . getState ( "proxy-process-pid" ) ;
20
24
if ( pid ) {
21
25
process . kill ( Number ( pid ) ) ;
22
26
}
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
- ) ;
32
27
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 ,
37
31
) ;
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
- }
44
32
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 ) ;
48
46
49
- try {
50
47
const artifactUploader = await getArtifactUploaderClient (
51
48
logger ,
52
49
gitHubVersion . type ,
@@ -61,10 +58,12 @@ async function runWrapper() {
61
58
retentionDays : 7 ,
62
59
} ,
63
60
) ;
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 } ` ) ;
67
61
}
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
+ ) ;
68
67
}
69
68
}
70
69
0 commit comments