File tree 1 file changed +19
-16
lines changed
1 file changed +19
-16
lines changed Original file line number Diff line number Diff line change @@ -38,23 +38,26 @@ async function main() {
38
38
const jobsCache : { [ runId : number ] : Job [ ] } = { } ;
39
39
40
40
async function getJobs ( runId : number ) {
41
- if ( jobsCache [ runId ] ) {
42
- return jobsCache [ runId ] ;
43
- }
44
- try {
45
- const jobs = await github . paginate (
46
- github . rest . actions . listJobsForWorkflowRun ,
47
- {
48
- owner : env . OWNER ,
49
- repo : env . REPOSITORY ,
50
- run_id : runId ,
51
- per_page : 100 ,
52
- } ,
53
- ) ;
54
- jobsCache [ runId ] = jobs ;
55
- return jobsCache [ runId ] ;
56
- } catch ( error ) {
41
+ if ( ! runId ) {
57
42
return [ ] ;
43
+ } else if ( jobsCache [ runId ] ) {
44
+ return jobsCache [ runId ] ;
45
+ } else {
46
+ try {
47
+ const jobs = await github . paginate (
48
+ github . rest . actions . listJobsForWorkflowRun ,
49
+ {
50
+ owner : env . OWNER ,
51
+ repo : env . REPOSITORY ,
52
+ run_id : runId ,
53
+ per_page : 100 ,
54
+ } ,
55
+ ) ;
56
+ jobsCache [ runId ] = jobs ;
57
+ return jobsCache [ runId ] ;
58
+ } catch ( error ) {
59
+ return [ ] ;
60
+ }
58
61
}
59
62
}
60
63
You can’t perform that action at this time.
0 commit comments