Skip to content

Add CodeQL analysis workflow configuration#308

Open
PeterDaveHello wants to merge 4 commits intomasterfrom
add-CodeQL-workflow
Open

Add CodeQL analysis workflow configuration#308
PeterDaveHello wants to merge 4 commits intomasterfrom
add-CodeQL-workflow

Conversation

@PeterDaveHello
Copy link
Collaborator

This workflow file sets up CodeQL analysis for the repository, defining triggers for pushes and pull requests to the master branch, as well as a scheduled analysis. It includes a matrix for analyzing multiple languages and steps for initializing and running the CodeQL analysis.

GitHub Copolot summary:

This pull request adds a new GitHub Actions workflow for advanced CodeQL analysis. The workflow is designed to automatically scan the codebase for security vulnerabilities and code quality issues across multiple languages on pushes, pull requests, and a weekly schedule.

Key additions in CI/CD and security automation:

  • Introduced .github/workflows/codeql.yml to enable CodeQL scanning for actions and javascript-typescript languages, running on both pushes and pull requests to the master branch, as well as on a weekly schedule.
  • Configured the workflow to use appropriate runners (ubuntu-latest or macos-latest for Swift), set up required permissions, and included placeholders for custom build steps and queries.
  • Added detailed comments and documentation within the workflow file to guide future customization and maintenance.

This workflow file sets up CodeQL analysis for the repository, defining triggers for pushes and pull requests to the master branch, as well as a scheduled analysis. It includes a matrix for analyzing multiple languages and steps for initializing and running the CodeQL analysis.
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Copy link
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

This pull request adds a comprehensive CodeQL analysis workflow to enhance the repository's security and code quality monitoring. The workflow automatically scans the codebase for vulnerabilities on pushes and pull requests to the master branch, as well as on a weekly schedule.

Changes:

  • Added .github/workflows/codeql.yml configuring CodeQL scanning for GitHub Actions workflow files and JavaScript/TypeScript code
  • Configured automated triggers for push, pull request, and scheduled (weekly) execution
  • Set up matrix-based analysis with appropriate build modes and permissions

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

Copy link

Copilot AI commented Feb 1, 2026

@PeterDaveHello I've opened a new pull request, #309, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: PeterDaveHello <3691490+PeterDaveHello@users.noreply.github.com>
Copy link

Copilot AI commented Feb 1, 2026

@PeterDaveHello I've opened a new pull request, #310, to work on those changes. Once the pull request is ready, I'll request review from you.

Copy link
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

Copilot reviewed 1 out of 1 changed files in this pull request and generated 5 comments.


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

# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL Advanced"
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The workflow name is set to "CodeQL Advanced" which may be confusing since this is a standard CodeQL workflow template, not necessarily an "advanced" configuration. Consider using a simpler name like "CodeQL Analysis" or "CodeQL" to better reflect the actual functionality, especially since the workflow uses default settings without custom queries or advanced configurations.

Suggested change
name: "CodeQL Advanced"
name: "CodeQL Analysis"

Copilot uses AI. Check for mistakes.
# - https://gh.io/supported-runners-and-hardware-resources
# - https://gh.io/using-larger-runners (GitHub.com only)
# Consider using larger runners or machines with greater resources for possible analysis time improvements.
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The runner configuration includes logic for Swift language support ('macos-latest' for Swift), but the matrix does not include Swift as one of the analyzed languages. This conditional logic is unnecessary for this repository. Consider simplifying the runs-on configuration to just 'ubuntu-latest' since neither 'actions' nor 'javascript-typescript' require macOS runners.

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

Copilot uses AI. Check for mistakes.
Comment on lines +46 to +47
- language: actions
build-mode: none
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The 'actions' language is configured for analysis, but this repository does not contain any composite actions (action.yml files). The 'actions' language in CodeQL is specifically for scanning GitHub Actions workflow definitions and composite action files. Since this repository only has workflow files that consume actions (not define them), the 'actions' language analysis is unnecessary and should be removed from the matrix.

Suggested change
- language: actions
build-mode: none

Copilot uses AI. Check for mistakes.
Comment on lines +48 to +49
- language: javascript-typescript
build-mode: none
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The 'javascript-typescript' language is configured, but this repository contains only JavaScript files (no TypeScript). While CodeQL's 'javascript-typescript' language can analyze pure JavaScript projects, it's worth verifying this is the intended configuration. The repository structure shows .js files in lib/, doctoc.js, and test files, but no .ts or .tsx files. Consider whether this is appropriate for your needs, as it may add unnecessary overhead for TypeScript-specific analysis rules.

Copilot uses AI. Check for mistakes.
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

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

The manual build step (lines 87-96) will cause the workflow to fail with 'exit 1' if a manual build mode is ever configured. While this is intentional placeholder behavior to force users to replace it with actual build commands, it creates a maintenance risk. Consider either removing this step entirely (since both current languages use 'build-mode: none') or changing the exit code to a warning message without failing the workflow. The current implementation will break the workflow if someone adds a compiled language without updating this step.

Suggested change
exit 1
echo 'WARNING: Manual build mode is configured but no build commands have been provided in this workflow step.'

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants