Skip to content

Commit 80d3214

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 80d3214

File tree

1 file changed

+71
-0
lines changed

1 file changed

+71
-0
lines changed

.github/workflows/codeql.yml

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

0 commit comments

Comments
 (0)