Skip to content

Update README.md

Update README.md #11

# Workflow for scanning code with CodeQL
name: codeql-wrapper-monorepo-only-changed-files
# Trigger workflow
on:
pull_request:
branches: [ main ]
jobs:
codeql-analysis:
name: codeql-wrapper-monorepo-pr
runs-on: ubuntu-latest
permissions:
security-events: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Python
run: |
chmod +x ./install_python.sh
./install_python.sh
# https://test.pypi.org/project/codeql-wrapper/
- name: Install CodeQL Wrapper
run: |
pip install -i https://test.pypi.org/simple/ codeql-wrapper
codeql-wrapper --version
- name: Run CodeQL Analysis
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
run: |
echo "$GITHUB_BASE_REF"
git fetch origin $GITHUB_BASE_REF --depth=2
git diff $(git rev-parse origin/$GITHUB_BASE_REF) HEAD --name-only
codeql-wrapper --verbose analyze ./monorepo --monorepo --upload-sarif --only-changed-files --base-ref main -ref HEAD --max-workers 1
# if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
# # For pull requests, compare against the base branch
# git fetch origin "$GITHUB_BASE_REF" --depth=2
# codeql-wrapper --verbose analyze ./monorepo --monorepo --upload-sarif --only-changed-files --base-ref "origin/$GITHUB_BASE_REF" --max-workers 1
# else
# # For push events, ensure enough history is available
# git fetch origin --depth=2
# codeql-wrapper --verbose analyze ./monorepo --monorepo --upload-sarif --only-changed-files --base-ref "origin/main" --max-workers 1
# fi