Skip to content

Commit c91c69a

Browse files
authored
Create codeql.yml (#626)
* Create codeql.yml Have an advanced codeql file. * Create codeql-config.yml added codeql config to skip dist and build codeql scanning * Update CodeQL workflow with npm and env settings
1 parent 11af25e commit c91c69a

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

.github/codeql/codeql-config.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: "CodeQL config"
2+
3+
queries:
4+
- uses: security-and-quality
5+
6+
paths:
7+
- src
8+
paths-ignore:
9+
- build
10+
- dist

.github/workflows/codeql.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL Advanced"
13+
14+
on:
15+
push:
16+
branches: [ "main", release/stable ]
17+
pull_request:
18+
branches: [ "main" ]
19+
schedule:
20+
- cron: '35 1 * * 5'
21+
22+
jobs:
23+
analyze:
24+
name: Analyze (${{ matrix.language }})
25+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
26+
permissions:
27+
# required for all workflows
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
include:
36+
- language: javascript-typescript
37+
build-mode: none
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v4
41+
42+
# Initializes the CodeQL tools for scanning.
43+
- name: Initialize CodeQL
44+
uses: github/codeql-action/init@v3
45+
with:
46+
languages: ${{ matrix.language }}
47+
config-file: ./.github/codeql/codeql-config.yml
48+
49+
- name: Setup Node.js environment
50+
uses: actions/setup-node@v3
51+
with:
52+
node-version: 16.x
53+
registry-url: https://npm.pkg.github.com
54+
55+
- name: Install npm@9
56+
run: npm i -g npm@9
57+
58+
- name: Build and test
59+
run: |
60+
npm config set //npm.pkg.github.com/:_authToken=${{ secrets.GPR_ACCESS_TOKEN }}
61+
npm ci
62+
npm run ci
63+
env:
64+
AZ_DevOps_Read_PAT: ${{ secrets.AZ_DevOps_Read_PAT }}
65+
66+
- name: Perform CodeQL Analysis
67+
uses: github/codeql-action/analyze@v3
68+
with:
69+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)