IX PR Babysit Nightly Consolidation #120
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: IX PR Babysit Nightly Consolidation | |
| on: | |
| schedule: | |
| - cron: "17 2 * * *" | |
| workflow_call: | |
| inputs: | |
| max_prs: | |
| description: "Max open PRs to scan" | |
| required: false | |
| default: "200" | |
| type: string | |
| retry_failure_policy: | |
| description: "Retry planning mode for per-PR snapshots: any or non-actionable-only" | |
| required: false | |
| default: "any" | |
| type: string | |
| stale_days: | |
| description: "Age threshold (days) used for stale/no-progress buckets" | |
| required: false | |
| default: "7" | |
| type: string | |
| include_drafts: | |
| description: "Include draft PRs in nightly scan" | |
| required: false | |
| default: false | |
| type: boolean | |
| approved_bots: | |
| description: "Comma-separated approved bot logins for source classification" | |
| required: false | |
| default: "intelligencex-review,intelligencex-review[bot],chatgpt-codex-connector[bot]" | |
| type: string | |
| source: | |
| description: "Source tag written into pr-watch snapshots" | |
| required: false | |
| default: "" | |
| type: string | |
| publish_tracking_issue: | |
| description: "When true, create/update a source-specific tracker issue with latest rollup" | |
| required: false | |
| default: true | |
| type: boolean | |
| apply_governance_signal_label: | |
| description: "When true, manage a retry-policy governance label on the tracker issue" | |
| required: false | |
| default: false | |
| type: boolean | |
| tracker_issue_title: | |
| description: "Optional explicit tracker issue title (defaults to source-specific title)" | |
| required: false | |
| default: "" | |
| type: string | |
| tracker_issue_labels: | |
| description: "Comma-separated labels to apply on tracker issue create/update (optional)" | |
| required: false | |
| default: "" | |
| type: string | |
| workflow_dispatch: | |
| inputs: | |
| max_prs: | |
| description: "Max open PRs to scan" | |
| required: false | |
| default: "200" | |
| retry_failure_policy: | |
| description: "Retry planning mode for per-PR snapshots: any or non-actionable-only" | |
| required: false | |
| default: "any" | |
| stale_days: | |
| description: "Age threshold (days) used for stale/no-progress buckets" | |
| required: false | |
| default: "7" | |
| include_drafts: | |
| description: "Include draft PRs in nightly scan" | |
| required: false | |
| default: false | |
| type: boolean | |
| approved_bots: | |
| description: "Comma-separated approved bot logins for source classification" | |
| required: false | |
| default: "intelligencex-review,intelligencex-review[bot],chatgpt-codex-connector[bot]" | |
| source: | |
| description: "Optional source tag override for pr-watch snapshots" | |
| required: false | |
| default: "" | |
| publish_tracking_issue: | |
| description: "When true, create/update a source-specific tracker issue with latest rollup" | |
| required: false | |
| default: false | |
| type: boolean | |
| apply_governance_signal_label: | |
| description: "When true, manage a retry-policy governance label on the tracker issue" | |
| required: false | |
| default: false | |
| type: boolean | |
| tracker_issue_title: | |
| description: "Optional explicit tracker issue title (defaults to source-specific title)" | |
| required: false | |
| default: "" | |
| tracker_issue_labels: | |
| description: "Comma-separated labels to apply on tracker issue create/update (optional)" | |
| required: false | |
| default: "" | |
| permissions: | |
| actions: read | |
| contents: read | |
| issues: write | |
| pull-requests: read | |
| env: | |
| PR_WATCH_STATE_DIR: artifacts/pr-watch | |
| PR_WATCH_NIGHTLY_DIR: artifacts/pr-watch/nightly | |
| PR_WATCH_NIGHTLY_SUMMARY_PATH: artifacts/pr-watch/ix-pr-watch-nightly-summary.md | |
| PR_WATCH_NIGHTLY_ROLLUP_PATH: artifacts/pr-watch/ix-pr-watch-nightly-rollup.json | |
| PR_WATCH_NIGHTLY_METRICS_PATH: artifacts/pr-watch/ix-pr-watch-nightly-metrics.json | |
| PR_WATCH_METRICS_HISTORY_PATH: artifacts/pr-watch/ix-pr-watch-nightly-metrics-history.json | |
| PR_WATCH_NIGHTLY_TRACKER_PATH: artifacts/pr-watch/ix-pr-watch-nightly-tracker.md | |
| PR_WATCH_STATE_CACHE_PREFIX: ix-pr-watch-state-${{ github.repository }}-${{ github.ref_name }} | |
| PR_WATCH_STATE_CACHE_KEY: ix-pr-watch-state-${{ github.repository }}-${{ github.ref_name }}-${{ github.run_id }} | |
| jobs: | |
| consolidate: | |
| # While private, prefer self-hosted runners to avoid GitHub-hosted spend limits. | |
| # Set repository variable IX_FORCE_GITHUB_HOSTED=true to bypass self-hosted runners temporarily. | |
| # When public, use GitHub-hosted runners by default. | |
| runs-on: ${{ fromJSON((github.event.repository.private && vars.IX_FORCE_GITHUB_HOSTED != 'true') && '["self-hosted","ubuntu"]' || '["ubuntu-latest"]') }} | |
| timeout-minutes: 30 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@9a946fdbd5fb07b82b2f5a4466058b876ab72bb2 # v5.3.0 | |
| with: | |
| dotnet-version: "8.0.x" | |
| - name: Restore pr-watch state cache | |
| uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: ${{ env.PR_WATCH_STATE_DIR }}/ix-pr-watch-*.json | |
| key: ${{ env.PR_WATCH_STATE_CACHE_KEY }} | |
| restore-keys: | | |
| ${{ env.PR_WATCH_STATE_CACHE_PREFIX }}- | |
| - name: Build CLI once | |
| run: dotnet build IntelligenceX.Cli/IntelligenceX.Cli.csproj --framework net8.0 -c Release /m:1 | |
| - name: Run nightly PR babysit consolidation engine | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: > | |
| dotnet ./IntelligenceX.Cli/bin/Release/net8.0/IntelligenceX.Cli.dll | |
| todo pr-watch-consolidate | |
| --repo "${{ github.repository }}" | |
| --max-prs "${{ inputs.max_prs }}" | |
| --max-flaky-retries "3" | |
| --retry-failure-policy "${{ inputs.retry_failure_policy }}" | |
| --stale-days "${{ inputs.stale_days }}" | |
| --include-drafts "${{ inputs.include_drafts }}" | |
| --approved-bots "${{ inputs.approved_bots }}" | |
| --source "${{ inputs.source }}" | |
| --run-link "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
| --snapshot-dir "${PR_WATCH_NIGHTLY_DIR}" | |
| --rollup-path "${PR_WATCH_NIGHTLY_ROLLUP_PATH}" | |
| --summary-path "${PR_WATCH_NIGHTLY_SUMMARY_PATH}" | |
| --metrics-path "${PR_WATCH_NIGHTLY_METRICS_PATH}" | |
| --metrics-history-path "${PR_WATCH_METRICS_HISTORY_PATH}" | |
| --tracker-path "${PR_WATCH_NIGHTLY_TRACKER_PATH}" | |
| --publish-tracking-issue "${{ inputs.publish_tracking_issue }}" | |
| --apply-governance-signal-label "${{ inputs.apply_governance_signal_label }}" | |
| --tracker-issue-title "${{ inputs.tracker_issue_title }}" | |
| --tracker-issue-labels "${{ inputs.tracker_issue_labels }}" | |
| - name: Upload nightly pr-watch artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: ix-pr-watch-nightly | |
| path: artifacts/pr-watch | |
| - name: Save pr-watch state cache | |
| if: ${{ always() && hashFiles('artifacts/pr-watch/ix-pr-watch-*.json') != '' }} | |
| uses: actions/cache/save@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: ${{ env.PR_WATCH_STATE_DIR }}/ix-pr-watch-*.json | |
| key: ${{ env.PR_WATCH_STATE_CACHE_KEY }} |