CodeQL Migration Automation #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CodeQL Migration Automation | |
on: | |
schedule: | |
- cron: '0 0 * * 1' # Runs every Monday at midnight UTC | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
migrate-codeql: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 # Add timeout to prevent hanging jobs | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all history for better migration | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
cache: 'pip' # Enables dependency caching | |
- name: Install Dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -r requirements.txt | |
- name: Run Migration Script | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
set -e # Exit if any command fails | |
python migrator.py || { echo "Migration failed. Check logs."; exit 1; } | |
- name: Notify on Failure | |
if: failure() | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
github.rest.issues.create({ | |
owner: context.repo.owner, | |
repo: context.repo.name, | |
title: 'CodeQL Migration Failed', | |
body: `Migration failed on ${new Date().toISOString()}. Please check the [workflow logs](${context.serverUrl}/${context.repo.owner}/${context.repo.name}/actions/runs/${context.runId}) for details.` | |
}) |