File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,6 +19,12 @@ function actionsUsedInWorkflow (workflow) {
1919 . map ( key => get ( workflow , key ) )
2020}
2121
22+ const scheduledWorkflows = workflows
23+ . map ( workflow => workflow . data . on . schedule )
24+ . filter ( Boolean )
25+ . flat ( )
26+ . map ( schedule => schedule . cron )
27+
2228const allUsedActions = chain ( workflows )
2329 . map ( actionsUsedInWorkflow )
2430 . flatten ( )
@@ -38,4 +44,16 @@ describe('GitHub Actions workflows', () => {
3844 const disallowedActions = difference ( allUsedActions , allowedActions )
3945 expect ( disallowedActions ) . toEqual ( [ ] )
4046 } )
47+
48+ test ( 'no scheduled workflows run on the hour' , ( ) => {
49+ const hourlySchedules = scheduledWorkflows . filter ( schedule => {
50+ const hour = schedule . split ( ' ' ) [ 0 ]
51+ return hour === '0' || hour === '00'
52+ } )
53+ expect ( hourlySchedules ) . toEqual ( [ ] )
54+ } )
55+
56+ test ( 'all scheduled workflows run at unique times' , ( ) => {
57+ expect ( scheduledWorkflows . length ) . toEqual ( new Set ( scheduledWorkflows ) . size )
58+ } )
4159} )
You can’t perform that action at this time.
0 commit comments