File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,4 +46,8 @@ Let's suppose you have a workflow with a job in it that at the end uploads an ar
4646 path : extract_here
4747 # Optional, defaults to current repo
4848 repo : ${{github.repository}}
49+ # Optional, check the workflow run whether it has an artifact
50+ # then will get the last available artifact from previous workflow
51+ # default false, just try to download from the last one
52+ check_artifacts : false
4953` ` `
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ inputs:
4848 description : Where to unpack the artifact
4949 required : false
5050 default : " ./"
51+ check_artifacts :
52+ description : Check workflow run whether it has an artifact
53+ required : false
5154runs :
5255 using : node12
5356 main : main.js
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ async function main() {
1919 let event = core . getInput ( "event" )
2020 let runID = core . getInput ( "run_id" )
2121 let runNumber = core . getInput ( "run_number" )
22+ let checkArtifacts = core . getInput ( "check_artifacts" )
2223
2324 const client = github . getOctokit ( token )
2425
@@ -75,6 +76,16 @@ async function main() {
7576 if ( workflowConclusion && ( workflowConclusion != run . conclusion && workflowConclusion != run . status ) ) {
7677 continue
7778 }
79+ if ( checkArtifacts ) {
80+ let artifacts = await client . actions . listWorkflowRunArtifacts ( {
81+ owner : owner ,
82+ repo : repo ,
83+ run_id : run . id ,
84+ } )
85+ if ( artifacts . data . artifacts . length == 0 ) {
86+ continue
87+ }
88+ }
7889 runID = run . id
7990 break
8091 }
You can’t perform that action at this time.
0 commit comments