Skip to content

Commit 0cd8f50

Browse files
authored
Merge pull request #53 from CSHS-CWRA/less-codeql-frequency
Adjust CodeQL configuration
2 parents e6d5299 + 0e5cacd commit 0cd8f50

File tree

1 file changed

+63
-52
lines changed

1 file changed

+63
-52
lines changed

.github/workflows/codeql.yml

Lines changed: 63 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ name: "CodeQL Advanced"
1313

1414
on:
1515
push:
16-
branches: [ "main" ]
16+
branches:
17+
- "main"
1718
pull_request:
18-
branches: [ "main" ]
19+
branches:
20+
- "main"
1921
schedule:
20-
- cron: '40 8 * * 2'
22+
- cron: '0 9 1 * *' # At 09:00 AM, on day 1 of the month
2123

2224
jobs:
2325
analyze:
@@ -31,10 +33,8 @@ jobs:
3133
permissions:
3234
# required for all workflows
3335
security-events: write
34-
3536
# required to fetch internal or private CodeQL packs
3637
packages: read
37-
3838
# only required for workflows in private repositories
3939
actions: read
4040
contents: read
@@ -43,56 +43,67 @@ jobs:
4343
fail-fast: false
4444
matrix:
4545
include:
46-
- language: c-cpp
47-
build-mode: autobuild
48-
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
49-
# Use `c-cpp` to analyze code written in C, C++ or both
50-
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
51-
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
52-
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
53-
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
54-
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
55-
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
46+
- language: c-cpp
47+
build-mode: autobuild
48+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
49+
# Use `c-cpp` to analyze code written in C, C++ or both
50+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
51+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
52+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
53+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
54+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
55+
# your codebase is analyzed, see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/codeql-code-scanning-for-compiled-languages
5656
steps:
57-
- name: Checkout repository
58-
uses: actions/checkout@v4
57+
- name: Harden Runner
58+
uses: step-security/harden-runner@4d991eb9b905ef189e4c376166672c3f2f230481 # v2.11.0
59+
with:
60+
disable-sudo: false
61+
allowed-endpoints: >
62+
api.github.com:443
63+
github.com:443
64+
objects.githubusercontent.com:443
65+
66+
- name: Checkout repository
67+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
68+
with:
69+
persist-credentials: false
5970

60-
# Add any setup steps before running the `github/codeql-action/init` action.
61-
# This includes steps like installing compilers or runtimes (`actions/setup-node`
62-
# or others). This is typically only required for manual builds.
63-
# - name: Setup runtime (example)
64-
# uses: actions/setup-example@v1
71+
# Add any setup steps before running the `github/codeql-action/init` action.
72+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
73+
# or others). This is typically only required for manual builds.
74+
# - name: Setup runtime (example)
75+
# uses: actions/setup-example@v1
6576

66-
# Initializes the CodeQL tools for scanning.
67-
- name: Initialize CodeQL
68-
uses: github/codeql-action/init@v3
69-
with:
70-
languages: ${{ matrix.language }}
71-
build-mode: ${{ matrix.build-mode }}
72-
# If you wish to specify custom queries, you can do so here or in a config file.
73-
# By default, queries listed here will override any specified in a config file.
74-
# Prefix the list here with "+" to use these queries and those in the config file.
77+
# Initializes the CodeQL tools for scanning.
78+
- name: Initialize CodeQL
79+
uses: github/codeql-action/init@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10
80+
with:
81+
languages: ${{ matrix.language }}
82+
build-mode: ${{ matrix.build-mode }}
83+
# If you wish to specify custom queries, you can do so here or in a config file.
84+
# By default, queries listed here will override any specified in a config file.
85+
# Prefix the list here with "+" to use these queries and those in the config file.
7586

76-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
77-
# queries: security-extended,security-and-quality
87+
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
88+
# queries: security-extended,security-and-quality
7889

79-
# If the analyze step fails for one of the languages you are analyzing with
80-
# "We were unable to automatically build your code", modify the matrix above
81-
# to set the build mode to "manual" for that language. Then modify this step
82-
# to build your code.
83-
# ℹ️ Command-line programs to run using the OS shell.
84-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
85-
- if: matrix.build-mode == 'manual'
86-
shell: bash
87-
run: |
88-
echo 'If you are using a "manual" build mode for one or more of the' \
89-
'languages you are analyzing, replace this with the commands to build' \
90-
'your code, for example:'
91-
echo ' make bootstrap'
92-
echo ' make release'
93-
exit 1
90+
# If the analyze step fails for one of the languages you are analyzing with
91+
# "We were unable to automatically build your code", modify the matrix above
92+
# to set the build mode to "manual" for that language. Then modify this step
93+
# to build your code.
94+
# ℹ️ Command-line programs to run using the OS shell.
95+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
96+
- if: matrix.build-mode == 'manual'
97+
shell: bash
98+
run: |
99+
echo 'If you are using a "manual" build mode for one or more of the' \
100+
'languages you are analyzing, replace this with the commands to build' \
101+
'your code, for example:'
102+
echo ' make bootstrap'
103+
echo ' make release'
104+
exit 1
94105
95-
- name: Perform CodeQL Analysis
96-
uses: github/codeql-action/analyze@v3
97-
with:
98-
category: "/language:${{matrix.language}}"
106+
- name: Perform CodeQL Analysis
107+
uses: github/codeql-action/analyze@b56ba49b26e50535fa1e7f7db0f4f7b4bf65d80d # v3.28.10
108+
with:
109+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)