44    secrets :
55      codecov_token :
66        required : true 
7+ permissions : {} 
78jobs :
89  lint :
910    name : Lint source files 
1011    runs-on : ubuntu-latest 
12+     permissions :
13+       contents : read  #  for actions/checkout
1114    steps :
1215      - name : Checkout repo 
13-         uses : actions/checkout@v2  
16+         uses : actions/checkout@v4  
1417        with :
1518          persist-credentials : false 
1619
@@ -35,31 +38,44 @@ jobs:
3538      - name : Spellcheck 
3639        run : npm run check:spelling 
3740
41+       - name : Lint GitHub Actions 
42+         uses : docker://rhysd/actionlint:latest 
43+         with :
44+           args : -color 
45+ 
3846  checkForCommonlyIgnoredFiles :
3947    name : Check for commonly ignored files 
4048    runs-on : ubuntu-latest 
49+     permissions :
50+       contents : read  #  for actions/checkout
4151    steps :
4252      - name : Checkout repo 
43-         uses : actions/checkout@v2  
53+         uses : actions/checkout@v4  
4454        with :
4555          persist-credentials : false 
4656
4757      - name : Check if commit contains files that should be ignored 
4858        run : | 
49-           git clone --depth 1 https://github.com/github/gitignore.git && 
50-           cat gitignore/Node.gitignore $(find gitignore/Global -name "*.gitignore" | grep -v ModelSim) > all.gitignore && 
51-           if  [[ "$(git ls-files -iX all.gitignore)" != "" ]]; then 
52-             echo "::error::Please remove these files:" 
53-             git ls-files -iX all.gitignore 
59+           git clone --depth 1 https://github.com/github/gitignore.git 
60+ 
61+           rm gitignore/Global/ModelSim.gitignore 
62+           rm gitignore/Global/Images.gitignore 
63+           cat gitignore/Node.gitignore gitignore/Global/*.gitignore > all.gitignore 
64+ 
65+           IGNORED_FILES=$(git ls-files --cached --ignored --exclude-from=all.gitignore) 
66+           if  [[ "$IGNORED_FILES" != "" ]]; then 
67+             echo -e "::error::Please remove these files:\n$IGNORED_FILES" | sed -z 's/\n/%0A/g' 
5468            exit 1 
5569          fi 
5670
5771   checkPackageLock :
5872    name : Check health of package-lock.json file 
5973    runs-on : ubuntu-latest 
74+     permissions :
75+       contents : read  #  for actions/checkout
6076    steps :
6177      - name : Checkout repo 
62-         uses : actions/checkout@v2  
78+         uses : actions/checkout@v4  
6379        with :
6480          persist-credentials : false 
6581
7288      - name : Install Dependencies 
7389        run : npm ci --ignore-scripts 
7490
91+       - name : Check that package-lock.json doesn't have conflicts 
92+         run : npm ls --depth 999 
93+ 
7594      - name : Run npm install 
7695        run : npm install --ignore-scripts --force --package-lock-only --engine-strict --strict-peer-deps 
7796
@@ -81,9 +100,11 @@ jobs:
81100  integrationTests :
82101    name : Run integration tests 
83102    runs-on : ubuntu-latest 
103+     permissions :
104+       contents : read  #  for actions/checkout
84105    steps :
85106      - name : Checkout repo 
86-         uses : actions/checkout@v2  
107+         uses : actions/checkout@v4  
87108        with :
88109          persist-credentials : false 
89110
@@ -103,9 +124,11 @@ jobs:
103124  fuzz :
104125    name : Run fuzzing tests 
105126    runs-on : ubuntu-latest 
127+     permissions :
128+       contents : read  #  for actions/checkout
106129    steps :
107130      - name : Checkout repo 
108-         uses : actions/checkout@v2  
131+         uses : actions/checkout@v4  
109132        with :
110133          persist-credentials : false 
111134
@@ -156,9 +179,11 @@ jobs:
156179    strategy :
157180      matrix :
158181        node_version_to_setup : [12, 14, 16, 17] 
182+     permissions :
183+       contents : read  #  for actions/checkout
159184    steps :
160185      - name : Checkout repo 
161-         uses : actions/checkout@v2  
186+         uses : actions/checkout@v4  
162187        with :
163188          persist-credentials : false 
164189
@@ -174,13 +199,35 @@ jobs:
174199      - name : Run Tests 
175200        run : npm run testonly 
176201
202+   codeql :
203+     name : Run CodeQL security scan 
204+     runs-on : ubuntu-latest 
205+     permissions :
206+       contents : read  #  for actions/checkout
207+       security-events : write  #  for codeql-action
208+     steps :
209+       - name : Checkout repo 
210+         uses : actions/checkout@v4 
211+         with :
212+           persist-credentials : false 
213+ 
214+       - name : Initialize CodeQL 
215+         uses : github/codeql-action/init@v3 
216+         with :
217+           languages : ' javascript, typescript' 
218+ 
219+       - name : Perform CodeQL analysis 
220+         uses : github/codeql-action/analyze@v3 
221+ 
177222  build-npm-dist :
178223    name : Build 'npmDist' artifact 
179224    runs-on : ubuntu-latest 
180225    needs : [test, fuzz, lint, integrationTests] 
226+     permissions :
227+       contents : read  #  for actions/checkout
181228    steps :
182229      - name : Checkout repo 
183-         uses : actions/checkout@v2  
230+         uses : actions/checkout@v4  
184231        with :
185232          persist-credentials : false 
186233
@@ -206,15 +253,18 @@ jobs:
206253    name : Build 'denoDist' artifact 
207254    runs-on : ubuntu-latest 
208255    needs : [test, fuzz, lint, integrationTests] 
256+     permissions :
257+       contents : read  #  for actions/checkout
209258    steps :
210259      - name : Checkout repo 
211-         uses : actions/checkout@v2  
260+         uses : actions/checkout@v4  
212261        with :
213262          persist-credentials : false 
214263
215264      - name : Setup Node.js 
216265        uses : actions/setup-node@v4 
217266        with :
267+           cache : npm 
218268          node-version-file : ' .node-version' 
219269
220270      - name : Install Dependencies 
0 commit comments