Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 3, 2025

This PR adds support for the new CodeQL matrix format that includes both language and build-mode fields, replacing the deprecated autobuild approach with the modern build-mode workflow.

Changes Made

New Matrix Format

  • Old format: ["swift", "python", "rust", "go", "javascript", "java"]
  • New format:
{
  "include": [
    {"language": "python", "build-mode": "none"},
    {"language": "swift", "build-mode": "manual"},
    {"language": "go", "build-mode": "manual"},
    {"language": "java", "build-mode": "manual"}
  ]
}

Build Mode Logic

  • Default: "none" for most languages (python, javascript, ruby, rust, actions, etc.)
  • Manual: "manual" for languages requiring custom build steps (go, swift, java)
  • Override: New build-mode-override input allows users to specify additional languages for manual build mode

Backward Compatibility

  • Maintains the existing languages output for backward compatibility
  • Adds new matrix output with the include format

Updated Workflow

The README now shows the modern CodeQL workflow:

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

- if: matrix.build-mode == 'manual'
  shell: bash
  run: |
    echo 'Replace this with your build commands'
    exit 1

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

New Input Parameter

Added build-mode-override input to allow users to specify languages that should use manual build mode:

- name: Get languages from repo
  uses: advanced-security/set-codeql-language-matrix@v1
  with:
    access-token: ${{ secrets.GITHUB_TOKEN }}
    endpoint: ${{ github.event.repository.languages_url }}
    build-mode-override: 'python, ruby'  # Force manual build for these languages

Testing

  • Comprehensive test suite covering all scenarios
  • Matrix format validation for GitHub Actions compatibility
  • End-to-end entrypoint flow validation
  • Language mapping and build mode logic verification

Fixes #18.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Add support for new matrix format with language and build-mode Add support for new matrix format with language and build-mode Jul 3, 2025
Copilot finished work on behalf of felickz July 3, 2025 20:34
@Copilot Copilot AI requested a review from felickz July 3, 2025 20:34
Copy link
Contributor

@felickz felickz left a comment

Choose a reason for hiding this comment

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

See my comments

- Track original repository languages that map to CodeQL languages
- Ensure kotlin repositories get manual build mode when mapped to java CodeQL language
- Handle multiple repository languages mapping to same CodeQL language
- Address code review feedback about repo-level language tracking

Co-authored-by: felickz <[email protected]>
@Copilot Copilot AI requested a review from felickz July 3, 2025 21:15
Copilot finished work on behalf of felickz July 3, 2025 21:15
Copilot finished work on behalf of felickz July 3, 2025 21:19
@Copilot Copilot AI requested a review from felickz July 3, 2025 21:33
Copilot finished work on behalf of felickz July 3, 2025 21:33
Copilot finished work on behalf of felickz July 3, 2025 21:42
Copilot finished work on behalf of felickz July 3, 2025 21:48
@Copilot Copilot AI requested a review from felickz July 3, 2025 21:48
Copy link
Contributor

@felickz felickz left a comment

Choose a reason for hiding this comment

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

Perfect

Java add - uses BMN:
image

Kotlin add - switches to manual
image

@felickz felickz marked this pull request as ready for review July 3, 2025 22:11
@felickz felickz requested a review from GeekMasher July 3, 2025 22:11
@felickz
Copy link
Contributor

felickz commented Jul 3, 2025

This should be back compat with the old non matrix , so either make this v1.4.0 or consider a v2/v2.0.0

Copy link
Contributor Author

Copilot AI commented Jul 3, 2025

This should be back compat with the old non matrix , so either make this v1.4.0 or consider a v2/v2.0.0

This should be v1.4.0 since the changes are backward compatible. The existing languages output is maintained for backward compatibility while the new matrix output provides the enhanced functionality. All existing workflows using the languages output will continue to work without modification.

Copilot finished work on behalf of felickz July 3, 2025 22:18
@Copilot Copilot AI requested a review from felickz July 3, 2025 22:18
@felickz felickz merged commit 60a19f3 into main Jul 29, 2025
3 checks passed
@felickz felickz deleted the copilot/fix-18 branch July 29, 2025 18:59
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.

Add support for new matrix format with language and build-mode
2 participants