File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
1
+ module . exports = async ( { github, context, core} ) => {
2
+ const fs = require ( 'fs' ) ;
3
+
4
+ const workflowRunId = process . env . WORKFLOW_ID ;
5
+ core . info ( `Listing artifacts for workflow run ${ workflowRunId } ` ) ;
6
+
7
+ const artifacts = await github . rest . actions . listWorkflowRunArtifacts ( {
8
+ owner : context . repo . owner ,
9
+ repo : context . repo . repo ,
10
+ run_id : workflowRunId ,
11
+ } ) ;
12
+
13
+ const matchArtifact = artifacts . data . artifacts . filter ( artifact => artifact . name == "pr" ) [ 0 ] ;
14
+
15
+ core . info ( `Downloading artifacts for workflow run ${ workflowRunId } ` ) ;
16
+ const artifact = await github . rest . actions . downloadArtifact ( {
17
+ owner : context . repo . owner ,
18
+ repo : context . repo . repo ,
19
+ artifact_id : matchArtifact . id ,
20
+ archive_format : 'zip' ,
21
+ } ) ;
22
+
23
+ core . info ( "Saving artifact found" , artifact ) ;
24
+
25
+ fs . writeFileSync ( 'pr.zip' , Buffer . from ( artifact . data ) ) ;
26
+ }
You can’t perform that action at this time.
0 commit comments