Skip to content

Commit 162fc18

Browse files
committed
fix: attempt to fix mutiple sarif issue & update codeql workflow
1 parent ed081ff commit 162fc18

File tree

2 files changed

+56
-44
lines changed

2 files changed

+56
-44
lines changed

.github/workflows/codacy.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,17 @@ jobs:
3030
permissions:
3131
contents: read # for actions/checkout to fetch code
3232
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
33+
3334
name: Codacy Security Scan
3435
runs-on: ubuntu-latest
3536
steps:
3637
# Checkout the repository to the GitHub Actions runner
3738
- name: Checkout code
38-
uses: actions/checkout@v6
39+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3940

4041
# Execute Codacy Analysis CLI and generate a SARIF output with the security issues identified during the analysis
4142
- name: Run Codacy Analysis CLI
42-
uses: codacy/codacy-analysis-cli-action@v4
43+
uses: codacy/codacy-analysis-cli-action@562ee3e92b8e92df8b67e0a5ff8aa8e261919c08 # v4.4.7
4344
with:
4445
# Check https://github.com/codacy/codacy-analysis-cli#project-token to get your project token from your Codacy repository
4546
# You can also omit the token and run the tools that support default configurations
@@ -55,7 +56,7 @@ jobs:
5556

5657
# Upload the SARIF file generated in the previous step
5758
- name: Upload SARIF results file
58-
uses: github/codeql-action/upload-sarif@v4
59+
uses: github/codeql-action/upload-sarif@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6
5960
with:
6061
sarif_file: results-codacy.sarif
61-
category: codacy
62+
category: /tool:codacy

.github/workflows/codeql-analysis.yml

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

1414
on:
1515
push:
@@ -21,73 +21,84 @@ on:
2121

2222
jobs:
2323
analyze:
24-
name: Analyze
24+
name: Analyze (${{ matrix.language }})
2525
# Runner size impacts CodeQL analysis time. To learn more, please see:
2626
# - https://gh.io/recommended-hardware-resources-for-running-codeql
2727
# - https://gh.io/supported-runners-and-hardware-resources
28-
# - https://gh.io/using-larger-runners
29-
# Consider using larger runners for possible analysis time improvements.
28+
# - https://gh.io/using-larger-runners (GitHub.com only)
29+
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
3030
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
31-
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
3231
permissions:
32+
# required for all workflows
33+
security-events: write
34+
35+
# required to fetch internal or private CodeQL packs
36+
packages: read
37+
38+
# only required for workflows in private repositories
3339
actions: read
3440
contents: read
35-
security-events: write
3641

3742
strategy:
3843
fail-fast: false
3944
matrix:
40-
language: [ 'csharp' ]
41-
# CodeQL supports [ 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'swift' ]
42-
# Use only 'java-kotlin' to analyze code written in Java, Kotlin or both
43-
# Use only 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
44-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
45+
include:
46+
- language: actions
47+
build-mode: none
48+
- language: csharp
49+
build-mode: manual
50+
# CodeQL supports the following values keywords for 'language': 'actions', 'c-cpp', 'csharp', 'go', 'java-kotlin', 'javascript-typescript', 'python', 'ruby', 'rust', 'swift'
51+
# Use `c-cpp` to analyze code written in C, C++ or both
52+
# Use 'java-kotlin' to analyze code written in Java, Kotlin or both
53+
# Use 'javascript-typescript' to analyze code written in JavaScript, TypeScript or both
54+
# To learn more about changing the languages that are analyzed or customizing the build mode for your analysis,
55+
# see https://docs.github.com/en/code-security/code-scanning/creating-an-advanced-setup-for-code-scanning/customizing-your-advanced-setup-for-code-scanning.
56+
# If you are analyzing a compiled language, you can modify the 'build-mode' for that language to customize how
57+
# 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
4558

4659
steps:
4760
- name: Checkout repository
48-
uses: actions/checkout@v6
61+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
62+
63+
# Add any setup steps before running the `github/codeql-action/init` action.
64+
# This includes steps like installing compilers or runtimes (`actions/setup-node`
65+
# or others). This is typically only required for manual builds.
66+
# - name: Setup runtime (example)
67+
# uses: actions/setup-example@v1
68+
69+
- name: Setup .NET Core
70+
if: ${{ matrix.language == 'csharp' }}
71+
uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # V5.2.0
72+
with:
73+
global-json-file: global.json
4974

5075
# Initializes the CodeQL tools for scanning.
5176
- name: Initialize CodeQL
52-
uses: github/codeql-action/init@v4
77+
uses: github/codeql-action/init@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6
5378
with:
5479
languages: ${{ matrix.language }}
80+
build-mode: ${{ matrix.build-mode }}
5581
# If you wish to specify custom queries, you can do so here or in a config file.
5682
# By default, queries listed here will override any specified in a config file.
5783
# Prefix the list here with "+" to use these queries and those in the config file.
58-
84+
5985
# 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
6086
# queries: security-extended,security-and-quality
61-
62-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
63-
# If this step fails, then you should remove it and run the build manually (see below)
64-
# - name: Autobuild
65-
# uses: github/codeql-action/autobuild@v3
66-
67-
- name: Setup .NET Core
68-
uses: actions/setup-dotnet@v5
69-
with:
70-
global-json-file: global.json
71-
72-
- name: Restore nHapi
87+
88+
# If the analyze step fails for one of the languages you are analyzing with
89+
# "We were unable to automatically build your code", modify the matrix above
90+
# to set the build mode to "manual" for that language. Then modify this step
91+
# to build your code.
92+
# ℹ️ Command-line programs to run using the OS shell.
93+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
94+
- name: Run manual build steps
95+
if: ${{ matrix.language == 'csharp' }}
96+
shell: bash
7397
run: |
7498
dotnet restore nHapi.sln --configfile build/.nuget/NuGet.config
75-
76-
- name: Build nHapi
77-
run: |
7899
dotnet build nHapi.sln -c Release --no-restore
79100
80-
# ℹ️ Command-line programs to run using the OS shell.
81-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
82-
83-
# If the Autobuild fails above, remove it and uncomment the following three lines.
84-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
85-
86-
# - run: |
87-
# echo "Run, Build Application using script"
88-
# ./location_of_script_within_repo/buildscript.sh
89-
90101
- name: Perform CodeQL Analysis
91-
uses: github/codeql-action/analyze@v4
102+
uses: github/codeql-action/analyze@0d579ffd059c29b07949a3cce3983f0780820c98 # v4.32.6
92103
with:
93104
category: "/language:${{matrix.language}}"

0 commit comments

Comments
 (0)