Get started with the Static Analysis Workflow Automation in 5 minutes.
# Ensure Python 3.7+ is installed
python3 --version
# Ensure Git is installed
git --version# 1. Clone or navigate to this repository
cd /path/to/this/repo
# 2. Install dependencies
pip install -r requirements.txt# Add workflow to the current repository
python3 add-static-analysis-workflow.py
# Or specify a repository path
python3 add-static-analysis-workflow.py /path/to/target/repo# Create a text file with repository paths (one per line)
cat > repos.txt << EOF
/path/to/repo1
/path/to/repo2
/path/to/repo3
EOF
# Process all repositories
python3 batch-add-workflows.py --repo-file repos.txt# View the generated workflow file
cat /path/to/repo/.github/workflows/static-analysis.yaml
# View the tracking log
cat /path/to/repo/tracking-log.json# View the batch report
cat batch-report.json
# Or use jq for pretty output
jq . batch-report.jsonBefore making changes, see what would happen:
python3 add-static-analysis-workflow.py --dry-runUse parallel processing for better performance:
python3 batch-add-workflows.py --repo-file repos.txt --parallel --max-workers 8The scripts are idempotent - running them multiple times won't cause issues:
# Running again on the same repo will skip if nothing changed
python3 add-static-analysis-workflow.py /path/to/repo
# Output: "Action: skipped - File already exists and matches template"The generated .github/workflows/static-analysis.yaml will look like:
name: Static Analysis
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
static-analysis:
uses: opslevel/.github/.github/workflows/static-analysis.yaml@mainThe branch name (main) is automatically detected for each repository.
After running the script on a repository, you'll have:
repository/
├── .github/
│ └── workflows/
│ └── static-analysis.yaml ← The workflow file
└── tracking-log.json ← Operation log
- Read WORKFLOW_AUTOMATION.md for detailed documentation
- Run the test suite:
python3 test_workflow_implementation.py - Check examples in the
examples/directory
pip install PyYAMLThe repository might not have a remote tracking branch set up. Check:
cd /path/to/repo
git remote -v
git branch -aRun with -h or --help for command options:
python3 add-static-analysis-workflow.py --help
python3 batch-add-workflows.py --help