Skip to content

๐Ÿš€ ๐˜ผ๐™ช๐™ฉ๐™ค๐™ข๐™–๐™ฉ๐™š ๐˜พ๐™ค๐™™๐™š๐™Œ๐™‡ ๐™ซ๐Ÿฎ โžœ ๐™ซ๐Ÿฏ ๐™ˆ๐™ž๐™œ๐™ง๐™–๐™ฉ๐™ž๐™ค๐™ฃ | ๐—จ๐—ฝ๐—ด๐—ฟ๐—ฎ๐—ฑ๐—ฒ ๐—š๐—ถ๐˜๐—›๐˜‚๐—ฏ ๐—”๐—ฐ๐˜๐—ถ๐—ผ๐—ป๐˜€ ๐—ช๐—ผ๐—ฟ๐—ธ๐—ณ๐—น๐—ผ๐˜„๐˜€ ๐—˜๐—ฎ๐˜€๐—ถ๐—น๐˜† ๐Ÿš€

License

Notifications You must be signed in to change notification settings

khulnasoft-lab/codeql-migrator

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

18 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš€ CodeQL Migrator

Automate the migration of CodeQL Action from v2 to v3 across GitHub repositories.

โ“ Why CodeQL Migrator?

GitHub has deprecated CodeQL Action v2, and workflows using it may eventually break. This tool:

  • Finds repositories still using CodeQL v2.
  • Automatically updates workflows to CodeQL v3.
  • Creates pull requests to suggest upgrades.

๐Ÿ“Œ Features

โœ… Scans repositories for CodeQL v2 usage.
โœ… Updates workflow files to use CodeQL v3.
โœ… Creates pull requests with upgrade suggestions.
โœ… Works on public and private repositories.
โœ… Can be run manually or as a GitHub Action.

๐Ÿš€ Getting Started

1๏ธโƒฃ Clone the Repository

git clone https://github.com/YOUR-USERNAME/codeql-migrator.git
cd codeql-migrator

2๏ธโƒฃ Install Dependencies

python3 -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt

3๏ธโƒฃ Set Up GitHub Token

Create a GitHub Personal Access Token (PAT) with repo and workflow permissions.
Set it as an environment variable:

export GITHUB_TOKEN="your_personal_access_token"

4๏ธโƒฃ Run the Migration Script

python migrator.py

๐Ÿ›  Automate with GitHub Actions

You can schedule automated runs with GitHub Actions.
Create .github/workflows/run-migrator.yml:

name: Run CodeQL Migrator
on:
  schedule:
    - cron: '0 0 * * 1'  # Runs every Monday
  workflow_dispatch:  # Allows manual triggering
jobs:
  run-script:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3

      - name: Setup Python
        uses: actions/setup-python@v4
        with:
          python-version: '3.x'

      - name: Install Dependencies
        run: pip install requests pyyaml github3.py

      - name: Run Migration Script
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        run: python migrator.py

๐Ÿ›  Using as a GitHub Action

Add this workflow to your repository to automatically migrate CodeQL from v2 to v3:

:/.github/workflows/codeql-migration.yml name: CodeQL Migration on: schedule: - cron: '0 0 * * 1' # Runs every Monday workflow_dispatch:

jobs: migrate: runs-on: ubuntu-latest permissions: contents: write pull-requests: write steps: - uses: khulnasoft-lab/codeql-migrator@v1 with: github-token: ${{ secrets.GITHUB_TOKEN }}

Action Inputs

Input Description Required Default
github-token GitHub token for authentication Yes -
per-page Number of repositories to process No '10'
dry-run Show what would be done without making changes No 'false'
branch-name Name of the branch to create for changes No 'update-codeql-v3'
skip-cleanup Skip cleanup of cloned repositories No 'false'
max-workers Number of concurrent workers No '4'
log-level Logging verbosity No 'INFO'
commit-message Commit message for the changes No 'Update CodeQL action to v3'
pr-title Title for the pull request No 'Update CodeQL action from v2 to v3'
pr-body Body text for the pull request No 'This PR updates the CodeQL action from v2 to v3.'

๐Ÿ“– How It Works

1๏ธโƒฃ Finds repos using CodeQL v2 via GitHub API.
2๏ธโƒฃ Clones the repo and checks workflow files.
3๏ธโƒฃ Replaces uses: github/codeql-action/*@v2 with @v3.
4๏ธโƒฃ Commits changes & creates a pull request.

๐Ÿ›ก Security Considerations

  • The script does not store credentials.
  • Uses GitHub API rate-limits apply.
  • Verify pull requests before merging.

๐Ÿ’ก Roadmap

  • Add CLI options for manual repo input.
  • Improve logging and error handling.
  • Turn into a GitHub App for automatic suggestions.

๐Ÿค Contributing

PRs are welcome! Follow the standard GitHub workflow:

  1. Fork the repository.
  2. Create a feature branch (git checkout -b feature-name).
  3. Commit changes (git commit -m "Add new feature").
  4. Push to your branch (git push origin feature-name).
  5. Open a pull request.

๐Ÿ“œ License

Licensed under the MIT License.

โญ Star This Repo!

If this project helps you, give it a โญ on GitHub!

๐Ÿณ Docker Usage

The tool is available as a Docker image from GitHub Container Registry:

docker pull ghcr.io/khulnasoft-lab/codeql-migrator:latest

Run it with your GitHub token:

docker run -e GITHUB_TOKEN="your_token" ghcr.io/khulnasoft-lab/codeql-migrator:latest

You can also use it with additional parameters:

docker run -e GITHUB_TOKEN="your_token" ghcr.io/khulnasoft-lab/codeql-migrator:latest \
  --per-page 20 \
  --dry-run \
  --branch-name custom-branch

๐Ÿ”ฅ Automate your CodeQL upgrades today! ๐Ÿ”ฅ

About

๐Ÿš€ ๐˜ผ๐™ช๐™ฉ๐™ค๐™ข๐™–๐™ฉ๐™š ๐˜พ๐™ค๐™™๐™š๐™Œ๐™‡ ๐™ซ๐Ÿฎ โžœ ๐™ซ๐Ÿฏ ๐™ˆ๐™ž๐™œ๐™ง๐™–๐™ฉ๐™ž๐™ค๐™ฃ | ๐—จ๐—ฝ๐—ด๐—ฟ๐—ฎ๐—ฑ๐—ฒ ๐—š๐—ถ๐˜๐—›๐˜‚๐—ฏ ๐—”๐—ฐ๐˜๐—ถ๐—ผ๐—ป๐˜€ ๐—ช๐—ผ๐—ฟ๐—ธ๐—ณ๐—น๐—ผ๐˜„๐˜€ ๐—˜๐—ฎ๐˜€๐—ถ๐—น๐˜† ๐Ÿš€

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •