Skip to content

Commit 4698fc5

Browse files
committed
Added: CodeQL action to scan the github action scripts
We then get reports with potential issues in the security tab.
1 parent 2c1bd65 commit 4698fc5

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: "CodeQL analysis of GitHub action jobs"
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
schedule:
9+
# 9:44pm, every Sunday.
10+
- cron: '44 21 * * 0'
11+
12+
jobs:
13+
analyze:
14+
name: Analyze (${{ matrix.language }})
15+
# Runner size impacts CodeQL analysis time. To learn more, please see:
16+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
17+
# - https://gh.io/supported-runners-and-hardware-resources
18+
# - https://gh.io/using-larger-runners (GitHub.com only)
19+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
20+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
21+
permissions:
22+
# required for all workflows
23+
security-events: write
24+
25+
# required to fetch internal or private CodeQL packs
26+
packages: read
27+
28+
# only required for workflows in private repositories
29+
actions: read
30+
contents: read
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
include:
36+
- language: actions
37+
build-mode: none
38+
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
39+
# Use `c-cpp` to analyze code written in C, C++ or both
40+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
41+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
42+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
43+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
44+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
45+
# 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+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@v4
49+
50+
# Add any setup steps before running the `github/codeql-action/init` action.
51+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
52+
# or others). This is typically only required for manual builds.
53+
# - name: Setup runtime (example)
54+
# uses: actions/setup-example@v1
55+
56+
# Initializes the CodeQL tools for scanning.
57+
- name: Initialize CodeQL
58+
uses: github/codeql-action/init@v3
59+
with:
60+
languages: ${{ matrix.language }}
61+
build-mode: ${{ matrix.build-mode }}
62+
# If you wish to specify custom queries, you can do so here or in a config file.
63+
# By default, queries listed here will override any specified in a config file.
64+
# Prefix the list here with "+" to use these queries and those in the config file.
65+
66+
# 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
67+
# queries: security-extended,security-and-quality
68+
69+
- name: Perform CodeQL Analysis
70+
uses: github/codeql-action/analyze@v3
71+
with:
72+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)