File tree 3 files changed +14
-0
lines changed
3 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -72,4 +72,7 @@ Let's suppose you have a workflow with a job in it that at the end uploads an ar
72
72
# "fail", "warn", "ignore"
73
73
# default fail
74
74
if_no_artifact_found : fail
75
+ # Optional, ignore forks when searching for artifacts
76
+ # default true
77
+ allow_forks : false
75
78
` ` `
Original file line number Diff line number Diff line change @@ -55,6 +55,10 @@ inputs:
55
55
description : Where to unpack the artifact
56
56
required : false
57
57
default : " ./"
58
+ allow_forks :
59
+ description : Allow forks
60
+ required : false
61
+ default : true
58
62
check_artifacts :
59
63
description : Check workflow run whether it has an artifact
60
64
required : false
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ async function main() {
38
38
let runNumber = core . getInput ( "run_number" )
39
39
let checkArtifacts = core . getBooleanInput ( "check_artifacts" )
40
40
let searchArtifacts = core . getBooleanInput ( "search_artifacts" )
41
+ const allowForks = core . getBooleanInput ( "allow_forks" )
41
42
let dryRun = core . getInput ( "dry_run" )
42
43
43
44
const client = github . getOctokit ( token )
@@ -102,6 +103,8 @@ async function main() {
102
103
core . info ( `==> Run number: ${ runNumber } ` )
103
104
}
104
105
106
+ core . info ( `==> Allow forks: ${ allowForks } ` )
107
+
105
108
if ( ! runID ) {
106
109
// Note that the runs are returned in most recent first order.
107
110
for await ( const runs of client . paginate . iterator ( client . rest . actions . listWorkflowRuns , {
@@ -120,6 +123,10 @@ async function main() {
120
123
if ( workflowConclusion && ( workflowConclusion != run . conclusion && workflowConclusion != run . status ) ) {
121
124
continue
122
125
}
126
+ if ( ! allowForks && run . head_repository . full_name !== `${ owner } /${ repo } ` ) {
127
+ core . info ( `==> Skipping run from fork: ${ run . head_repository . full_name } ` )
128
+ continue
129
+ }
123
130
if ( checkArtifacts || searchArtifacts ) {
124
131
let artifacts = await client . paginate ( client . rest . actions . listWorkflowRunArtifacts , {
125
132
owner : owner ,
You can’t perform that action at this time.
0 commit comments