CI Autopilot Fixer #76
This file contains hidden or 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: CI Autopilot Fixer | |
| on: | |
| workflow_dispatch: | |
| repository_dispatch: | |
| types: [ci-autopilot] | |
| schedule: | |
| - cron: "0 2 * * *" | |
| permissions: | |
| contents: read | |
| issues: read | |
| jobs: | |
| fixer: | |
| runs-on: [self-hosted, Windows] | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| shell: pwsh | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| GITHUB_TOKEN: ${{ github.token }} | |
| steps: | |
| - name: Checkout clean workspace | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| clean: true | |
| fetch-depth: 1 | |
| - name: Preflight diagnostics | |
| run: | | |
| New-Item -ItemType Directory -Force logs | Out-Null | |
| "Runner: $env:RUNNER_NAME" | Out-File -FilePath logs\preflight.log | |
| "Repo: $env:GITHUB_REPOSITORY" | Out-File -FilePath logs\preflight.log -Append | |
| "Workspace: $env:GITHUB_WORKSPACE" | Out-File -FilePath logs\preflight.log -Append | |
| whoami | Out-File -FilePath logs\preflight.log -Append | |
| Get-Command git -ErrorAction SilentlyContinue | Out-File -FilePath logs\preflight.log -Append | |
| git --version 2>&1 | Out-File -FilePath logs\preflight.log -Append | |
| if (Get-Command python -ErrorAction SilentlyContinue) { python --version 2>&1 | Out-File -FilePath logs\preflight.log -Append } | |
| if (Get-Command py -ErrorAction SilentlyContinue) { py -3 --version 2>&1 | Out-File -FilePath logs\preflight.log -Append } | |
| if (Get-Command gh -ErrorAction SilentlyContinue) { gh --version 2>&1 | Out-File -FilePath logs\preflight.log -Append } | |
| "C:\\src\\ci-autopilot exists: $(Test-Path C:\\src\\ci-autopilot)" | Out-File -FilePath logs\preflight.log -Append | |
| - name: Python diagnostics | |
| run: | | |
| if (Get-Command python -ErrorAction SilentlyContinue) { | |
| python --version | |
| } elseif (Get-Command py -ErrorAction SilentlyContinue) { | |
| py -3 --version | |
| } else { | |
| throw "Python not found in PATH." | |
| } | |
| - name: Create venv | |
| run: | | |
| $py = Get-Command python -ErrorAction SilentlyContinue | |
| if ($py) { | |
| & $py.Source -m venv .venv | |
| return | |
| } | |
| $pyLauncher = Get-Command py -ErrorAction SilentlyContinue | |
| if ($pyLauncher) { | |
| & $pyLauncher.Source -3 -m venv .venv | |
| return | |
| } | |
| throw "Python not found for venv creation." | |
| - name: Install dependencies | |
| run: .\.venv\Scripts\python -m pip install -r requirements.txt | |
| - name: Run CI Autopilot | |
| run: | | |
| .\.venv\Scripts\python -m agent.poll_once 2>&1 | Tee-Object -FilePath logs\run.log | |
| if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } | |
| - name: Upload logs | |
| if: always() | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| name: ci-autopilot-logs | |
| path: logs\*.log |