@@ -3,8 +3,7 @@ import path from 'path'
33import fs from 'fs'
44import yaml from 'js-yaml'
55import flat from 'flat'
6- import { chain , difference , get } from 'lodash-es'
7- import allowedActions from '../../.github/allowed-actions.js'
6+ import { chain , get } from 'lodash-es'
87const __dirname = path . dirname ( fileURLToPath ( import . meta. url ) )
98const workflowsDir = path . join ( __dirname , '../../.github/workflows' )
109const workflows = fs
@@ -31,16 +30,13 @@ const scheduledWorkflows = workflows
3130const allUsedActions = chain ( workflows ) . map ( actionsUsedInWorkflow ) . flatten ( ) . uniq ( ) . sort ( ) . value ( )
3231
3332describe ( 'GitHub Actions workflows' , ( ) => {
34- test ( 'all used actions are allowed in .github/allowed-actions.js ' , ( ) => {
33+ test ( 'all used actions are listed ' , ( ) => {
3534 expect ( allUsedActions . length ) . toBeGreaterThan ( 0 )
36- const unusedActions = difference ( allowedActions , allUsedActions )
37- expect ( unusedActions ) . toEqual ( [ ] )
3835 } )
3936
40- test ( 'all allowed actions by .github/allowed-actions.js are used by at least one workflow' , ( ) => {
41- expect ( allowedActions . length ) . toBeGreaterThan ( 0 )
42- const disallowedActions = difference ( allUsedActions , allowedActions )
43- expect ( disallowedActions ) . toEqual ( [ ] )
37+ test . each ( allUsedActions ) ( 'requires specific hash: %p' , ( actionName ) => {
38+ const actionRegexp = / ^ [ A - Z a - z 0 - 9 - / ] + @ [ 0 - 9 a - f ] { 40 } $ /
39+ expect ( actionName ) . toMatch ( actionRegexp )
4440 } )
4541
4642 test ( 'no scheduled workflows run on the hour' , ( ) => {
0 commit comments