Skip to content

Commit 02f374d

Browse files
[fix](build): fix actions(@RalphHightower/blog) (#642)
Signed-off-by: Ralph Hightower <[email protected]>
1 parent 63d3b67 commit 02f374d

File tree

1 file changed

+65
-43
lines changed

1 file changed

+65
-43
lines changed

.github/workflows/codeql.yml

Lines changed: 65 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -9,70 +9,92 @@
99
# the `language` matrix defined below to confirm you have the correct set of
1010
# supported CodeQL languages.
1111
#
12-
name: "CodeQL"
12+
name: "CodeQL Advanced"
1313

1414
on:
1515
push:
16-
branches: ["main"]
16+
branches: [ "main", "main*" ]
1717
pull_request:
18-
# The branches below must be a subset of the branches above
19-
branches: ["main"]
18+
branches: [ "main", "main*" ]
2019
schedule:
21-
- cron: "0 0 * * 1"
20+
- cron: '43 4 * * 3'
2221

2322
permissions:
2423
contents: read
2524

2625
jobs:
2726
analyze:
28-
name: Analyze
29-
runs-on: ubuntu-latest
27+
name: Analyze (${{ matrix.language }})
28+
# Runner size impacts CodeQL analysis time. To learn more, please see:
29+
# - https://gh.io/recommended-hardware-resources-for-running-codeql
30+
# - https://gh.io/supported-runners-and-hardware-resources
31+
# - https://gh.io/using-larger-runners (GitHub.com only)
32+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
33+
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
3034
permissions:
35+
# required for all workflows
36+
security-events: write
37+
38+
# required to fetch internal or private CodeQL packs
39+
packages: read
40+
41+
# only required for workflows in private repositories
3142
actions: read
3243
contents: read
33-
security-events: write
3444

3545
strategy:
3646
fail-fast: false
3747
matrix:
38-
language: ["ruby"]
39-
# CodeQL supports [ $supported-codeql-languages ]
40-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
41-
48+
include:
49+
- language: ruby
50+
build-mode: none
51+
# CodeQL supports the following values keywords for 'language': 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift'
52+
# Use `c-cpp` to analyze code written in C, C++ or both
53+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
54+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
55+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
56+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
57+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
58+
# 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
4259
steps:
43-
- name: Harden the runner (Audit all outbound calls)
44-
uses: step-security/harden-runner@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0
45-
with:
46-
egress-policy: audit
47-
48-
- name: Checkout repository
49-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
50-
51-
# Initializes the CodeQL tools for scanning.
52-
- name: Initialize CodeQL
53-
uses: github/codeql-action/autobuild@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
54-
with:
55-
languages: ${{ matrix.language }}
56-
# If you wish to specify custom queries, you can do so here or in a config file.
57-
# By default, queries listed here will override any specified in a config file.
58-
# Prefix the list here with "+" to use these queries and those in the config file.
60+
- name: Harden Runner
61+
uses: step-security/[email protected]
62+
with:
63+
egress-policy: audit
5964

60-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
61-
# If this step fails, then you should remove it and run the build manually (see below)
62-
- name: Autobuild
63-
uses: github/codeql-action/autobuild@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
65+
- name: Checkout repository
66+
uses: actions/[email protected]
6467

65-
# ℹ️ Command-line programs to run using the OS shell.
66-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
68+
# Initializes the CodeQL tools for scanning.
69+
- name: Initialize CodeQL
70+
uses: github/codeql-action/[email protected]
71+
with:
72+
languages: ${{ matrix.language }}
73+
build-mode: ${{ matrix.build-mode }}
74+
# If you wish to specify custom queries, you can do so here or in a config file.
75+
# By default, queries listed here will override any specified in a config file.
76+
# Prefix the list here with "+" to use these queries and those in the config file.
6777

68-
# If the Autobuild fails above, remove it and uncomment the following three lines.
69-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
78+
# 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
79+
# queries: security-extended,security-and-quality
7080

71-
# - run: |
72-
# echo "Run, Build Application using script"
73-
# ./location_of_script_within_repo/buildscript.sh
81+
# If the analyze step fails for one of the languages you are analyzing with
82+
# "We were unable to automatically build your code", modify the matrix above
83+
# to set the build mode to "manual" for that language. Then modify this step
84+
# to build your code.
85+
# ℹ️ Command-line programs to run using the OS shell.
86+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
87+
- if: matrix.build-mode == 'manual'
88+
shell: bash
89+
run: |
90+
echo 'If you are using a "manual" build mode for one or more of the' \
91+
'languages you are analyzing, replace this with the commands to build' \
92+
'your code, for example:'
93+
echo ' make bootstrap'
94+
echo ' make release'
95+
exit 1
7496
75-
- name: Perform CodeQL Analysis
76-
uses: github/codeql-action/analyze@4e828ff8d448a8a6e532957b1811f387a63867e8 # v3.29.4
77-
with:
78-
category: "/language:${{matrix.language}}"
97+
- name: Perform CodeQL Analysis
98+
uses: github/codeql-action/analyze@v3.28.11
99+
with:
100+
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)