|
| 1 | +# Static Analysis Workflow Automation - File Index |
| 2 | + |
| 3 | +## Core Scripts |
| 4 | + |
| 5 | +### Main Automation Script |
| 6 | +- **`add-static-analysis-workflow.py`** - Primary script to add/update static analysis workflow in a single repository |
| 7 | + - Detects default branch automatically |
| 8 | + - Validates YAML syntax |
| 9 | + - Compares with existing files |
| 10 | + - Creates tracking logs |
| 11 | + - Usage: `python3 add-static-analysis-workflow.py [repo_path]` |
| 12 | + |
| 13 | +### Batch Processing Script |
| 14 | +- **`batch-add-workflows.py`** - Process multiple repositories at once |
| 15 | + - Sequential or parallel execution |
| 16 | + - Consolidated reporting |
| 17 | + - Handles failures gracefully |
| 18 | + - Usage: `python3 batch-add-workflows.py --repos repo1 repo2` or `--repo-file repos.txt` |
| 19 | + |
| 20 | +## Testing |
| 21 | + |
| 22 | +### Unit Tests |
| 23 | +- **`test_workflow_implementation.py`** - Core functionality tests |
| 24 | + - Tests script execution |
| 25 | + - Verifies file creation |
| 26 | + - Checks idempotency |
| 27 | + - Validates tracking logs |
| 28 | + - Run: `python3 test_workflow_implementation.py` |
| 29 | + |
| 30 | +### Integration Tests |
| 31 | +- **`integration_test.py`** - End-to-end testing |
| 32 | + - Creates temporary test repositories |
| 33 | + - Tests branch detection |
| 34 | + - Verifies batch processing |
| 35 | + - Tests YAML validation |
| 36 | + - Run: `python3 integration_test.py` |
| 37 | + |
| 38 | +## Documentation |
| 39 | + |
| 40 | +### Getting Started |
| 41 | +- **`README.md`** - Repository overview with quick start |
| 42 | +- **`QUICKSTART.md`** - 5-minute quick start guide |
| 43 | +- **`WORKFLOW_AUTOMATION.md`** - Complete reference documentation |
| 44 | + |
| 45 | +### Configuration |
| 46 | +- **`requirements.txt`** - Python dependencies (PyYAML) |
| 47 | +- **`.gitignore`** - Git ignore patterns |
| 48 | + |
| 49 | +### Examples |
| 50 | +- **`examples/repos-example.txt`** - Example repository list format |
| 51 | +- **`examples/usage-examples.sh`** - Common usage scenarios |
| 52 | + |
| 53 | +## Generated Files |
| 54 | + |
| 55 | +### Workflow File (in target repositories) |
| 56 | +- **`.github/workflows/static-analysis.yaml`** - The standardized workflow |
| 57 | + - Uses shared OpsLevel template |
| 58 | + - Configured with detected default branch |
| 59 | + - Triggers on push and pull_request |
| 60 | + |
| 61 | +### Logs (in target repositories) |
| 62 | +- **`tracking-log.json`** - Operation history |
| 63 | + - Timestamps |
| 64 | + - Actions taken (created/updated/skipped) |
| 65 | + - Branch information |
| 66 | + - Success/failure status |
| 67 | + |
| 68 | +### Reports (from batch operations) |
| 69 | +- **`batch-report.json`** - Consolidated batch processing report |
| 70 | + - Summary statistics |
| 71 | + - Individual repository results |
| 72 | + - Error details |
| 73 | + |
| 74 | +## Workflow Template |
| 75 | + |
| 76 | +The automation creates this standardized workflow: |
| 77 | + |
| 78 | +```yaml |
| 79 | +name: Static Analysis |
| 80 | + |
| 81 | +on: |
| 82 | + push: |
| 83 | + branches: |
| 84 | + - [detected-branch] |
| 85 | + pull_request: |
| 86 | + branches: |
| 87 | + - [detected-branch] |
| 88 | + |
| 89 | +jobs: |
| 90 | + static-analysis: |
| 91 | + uses: opslevel/.github/.github/workflows/static-analysis.yaml@main |
| 92 | +``` |
| 93 | +
|
| 94 | +## Dependencies |
| 95 | +
|
| 96 | +- Python 3.7+ |
| 97 | +- PyYAML 6.0+ |
| 98 | +- Git |
| 99 | +
|
| 100 | +## Quick Reference |
| 101 | +
|
| 102 | +### Single Repository |
| 103 | +```bash |
| 104 | +python3 add-static-analysis-workflow.py /path/to/repo |
| 105 | +``` |
| 106 | + |
| 107 | +### Dry Run |
| 108 | +```bash |
| 109 | +python3 add-static-analysis-workflow.py --dry-run |
| 110 | +``` |
| 111 | + |
| 112 | +### Multiple Repositories |
| 113 | +```bash |
| 114 | +python3 batch-add-workflows.py --repo-file repos.txt |
| 115 | +``` |
| 116 | + |
| 117 | +### Parallel Processing |
| 118 | +```bash |
| 119 | +python3 batch-add-workflows.py --repo-file repos.txt --parallel --max-workers 8 |
| 120 | +``` |
| 121 | + |
| 122 | +### Run Tests |
| 123 | +```bash |
| 124 | +python3 test_workflow_implementation.py |
| 125 | +python3 integration_test.py |
| 126 | +``` |
| 127 | + |
| 128 | +## Support |
| 129 | + |
| 130 | +For detailed usage instructions, see: |
| 131 | +- [QUICKSTART.md](QUICKSTART.md) - Quick start guide |
| 132 | +- [WORKFLOW_AUTOMATION.md](WORKFLOW_AUTOMATION.md) - Full documentation |
0 commit comments