File tree Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Expand file tree Collapse file tree 2 files changed +29
-5
lines changed Original file line number Diff line number Diff line change
1
+ repos :
2
+ - repo : local
3
+ hooks :
4
+ - id : compile-ts
5
+ name : Compile typescript
6
+ files : \.[tj]s$
7
+ language : system
8
+ entry : npm run build
9
+ pass_filenames : false
10
+ - id : lint-ts
11
+ name : Lint typescript code
12
+ files : \.ts$
13
+ language : system
14
+ entry : npm run lint -- --fix
15
+ - id : pr-checks-sync
16
+ name : Synchronize PR check workflows
17
+ files : ^.github/workflows/__.*\.yml$|^pr-checks
18
+ language : system
19
+ entry : python3 pr-checks/sync.py
20
+ pass_filenames : false
Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python
2
+
1
3
import ruamel .yaml
2
4
from ruamel .yaml .scalarstring import FoldedScalarString
3
- import os
5
+ import pathlib
4
6
import textwrap
5
7
6
8
# The default set of CodeQL Bundle versions to use for the PR checks.
@@ -47,9 +49,11 @@ def writeHeader(checkStream):
47
49
yaml = ruamel .yaml .YAML ()
48
50
yaml .Representer = NonAliasingRTRepresenter
49
51
52
+ this_dir = pathlib .Path (__file__ ).resolve ().parent
53
+
50
54
allJobs = {}
51
- for file in os . listdir ( 'checks' ):
52
- with open (f"checks/ { file } " , 'r' ) as checkStream :
55
+ for file in ( this_dir / 'checks' ). glob ( '*.yml ' ):
56
+ with open (file , 'r' ) as checkStream :
53
57
checkSpecification = yaml .load (checkStream )
54
58
55
59
matrix = []
@@ -126,9 +130,9 @@ def writeHeader(checkStream):
126
130
checkJob ['env' ] = checkJob .get ('env' , {})
127
131
if 'CODEQL_ACTION_TEST_MODE' not in checkJob ['env' ]:
128
132
checkJob ['env' ]['CODEQL_ACTION_TEST_MODE' ] = True
129
- checkName = file [: len ( file ) - 4 ]
133
+ checkName = file . stem
130
134
131
- with open (f"../ .github/ workflows/ __{ checkName } .yml" , 'w' ) as output_stream :
135
+ with open (this_dir . parent / " .github" / " workflows" / f" __{ checkName } .yml" , 'w' ) as output_stream :
132
136
writeHeader (output_stream )
133
137
yaml .dump ({
134
138
'name' : f"PR Check - { checkSpecification ['name' ]} " ,
You can’t perform that action at this time.
0 commit comments