Skip to content

Add CodeQL workflow configuration#1962

Merged
iMicknl merged 1 commit intomainfrom
iMicknl-patch-1
Mar 30, 2026
Merged

Add CodeQL workflow configuration#1962
iMicknl merged 1 commit intomainfrom
iMicknl-patch-1

Conversation

@iMicknl
Copy link
Copy Markdown
Owner

@iMicknl iMicknl commented Mar 30, 2026

This pull request introduces a new GitHub Actions workflow to enable advanced CodeQL security analysis for the repository. The workflow is triggered on pushes, pull requests, and a weekly schedule, and it supports multiple languages.

Security and CI improvements:

  • Added a .github/workflows/codeql.yml workflow that runs CodeQL analysis for actions and python code on main branch pushes, pull requests, and on a weekly schedule. The workflow checks out the code, initializes CodeQL for each language, and performs security analysis, with results uploaded to GitHub Security tab.

Removed comments and unnecessary steps from CodeQL workflow.
@iMicknl iMicknl requested a review from tetienne as a code owner March 30, 2026 20:03
Copilot AI review requested due to automatic review settings March 30, 2026 20:03
@github-advanced-security
Copy link
Copy Markdown
Contributor

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@iMicknl iMicknl merged commit 8d375f4 into main Mar 30, 2026
16 checks passed
@iMicknl iMicknl deleted the iMicknl-patch-1 branch March 30, 2026 20:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a GitHub Actions workflow to run GitHub CodeQL “Advanced” analysis for this repository to surface security findings in the GitHub Security tab.

Changes:

  • Introduces a new .github/workflows/codeql.yml workflow.
  • Configures CodeQL runs on push/pull_request targeting main, plus a weekly scheduled run.
  • Sets up a matrix to analyze actions and python.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +23 to +26
- language: actions
build-mode: none
- language: python
build-mode: none
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The matrix.include list is mis-indented. As written, the - language: entries are at the same indentation level as include: which makes the YAML invalid (or changes the structure) and will prevent the workflow from running. Indent the list items under include:.

Suggested change
- language: actions
build-mode: none
- language: python
build-mode: none
- language: actions
build-mode: none
- language: python
build-mode: none

Copilot uses AI. Check for mistakes.
Comment on lines +28 to +40
- name: Checkout repository
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The steps list is mis-indented: the - name: entries are aligned with steps: instead of being nested under it. This makes the workflow YAML invalid and will cause the job to fail to parse. Indent each step item under steps:.

Suggested change
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"
- name: Checkout repository
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{matrix.language}}"

Copilot uses AI. Check for mistakes.
name: Analyze (${{ matrix.language }})
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
security-events: write
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The job sets explicit permissions, but it doesn't grant contents: read. If the repo is configured with restricted default token permissions, actions/checkout and CodeQL init may fail. Consider adding contents: read (and optionally actions: read per CodeQL docs) and only keep packages: read if it’s actually needed.

Suggested change
security-events: write
security-events: write
contents: read
actions: read

Copilot uses AI. Check for mistakes.
jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runs-on has a conditional branch for swift, but swift is not part of the matrix. This extra condition adds confusion without effect; consider simplifying runs-on to a single runner or removing the unused swift branch.

Suggested change
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
runs-on: ubuntu-latest

Copilot uses AI. Check for mistakes.
build-mode: none
steps:
- name: Checkout repository
uses: actions/checkout@v4
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow uses actions/checkout@v4 while other workflows in the repo use actions/checkout@v6 (e.g., .github/workflows/test.yml, .github/workflows/release.yml). Consider bumping to @v6 for consistency and to pick up the latest fixes.

Suggested change
uses: actions/checkout@v4
uses: actions/checkout@v6

Copilot uses AI. Check for mistakes.
@iMicknl iMicknl added the enhancement New feature or request label Mar 30, 2026
@iMicknl
Copy link
Copy Markdown
Owner Author

iMicknl commented Mar 30, 2026

@copilot can you fix all feedback in a follow up PR?

@iMicknl
Copy link
Copy Markdown
Owner Author

iMicknl commented Mar 30, 2026

@copilot please fix all feedback in a follow-up PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants