Repository navigation
[ci] Prevent scheduled workflows from running in forks - #37749
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.sh | bash -s -- 37749Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/maui/main/eng/scripts/get-maui-pr.ps1) } 37749" |
|
Azure Pipelines: 1 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
There was a problem hiding this comment.
Pull request overview
Updates scheduled and agentic workflows to run only in the canonical dotnet/maui repository.
Changes:
- Adds upstream repository guards to scheduled and pre-activation jobs.
- Preserves regression-scanner activation checks.
- Regenerates affected gh-aw lock files.
A critical issue remains: owner-only guards in other scheduled workflows can still allow forks under the dotnet organization to run.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
.github/workflows/validate-pat-pool.yml |
Restricts PAT validation. |
.github/workflows/skill-evaluation-soak.yml |
Restricts soak execution. |
.github/workflows/rerun-review-scanner.md |
Adds workflow-level repository guard. |
.github/workflows/rerun-review-scanner.lock.yml |
Regenerated guarded workflow. |
.github/workflows/release-readiness.yml |
Updates validation gating. |
.github/workflows/regression-corpus-scanner.md |
Separates repository and activation guards. |
.github/workflows/regression-corpus-scanner.lock.yml |
Regenerated guarded workflow. |
.github/workflows/merge-net11-to-release.yml |
Guards scheduled merge jobs. |
.github/workflows/merge-main-to-net11.yml |
Guards merge processing. |
.github/workflows/daily-template-size-tracking.yml |
Guards matrix preparation. |
.github/workflows/daily-repo-status.md |
Adds repository guard. |
.github/workflows/daily-repo-status.lock.yml |
Regenerated guarded workflow. |
.github/workflows/ci-status-net11.md |
Adds repository guard. |
.github/workflows/ci-status-net11.lock.yml |
Regenerated guarded workflow. |
.github/workflows/ci-status-main.md |
Adds repository guard. |
.github/workflows/ci-status-main.lock.yml |
Regenerated guarded workflow. |
Suppressed comments (1)
.github/workflows/release-readiness.yml:891
- This job is the PR-validation path, not a scheduled writer. Adding the canonical-repository check means a fork's own
pull_requestruns no longer execute the validation suite, even though the workflow is read-only and the previous condition intentionally enabled validation for every pull request. Keep this condition event-based (or explicitly exemptpull_request) so the fork-protection change remains limited to scheduled/background execution.
if: github.repository == 'dotnet/maui' && github.event_name == 'pull_request'
|
Confirmed both remaining review issues. The owner-only guards in |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
|
Implemented the carry-forward review findings in
Validation: every scheduled workflow root job is now canonical-repository guarded or explicitly PR-only; offline release-readiness suites passed (87 + 2,134 assertions). |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
Suppressed comments (4)
.github/workflows/ci-status-main.lock.yml:1223
- This lock regeneration also changes
GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURSfrom0to168, although the corresponding source workflow has no failure-issue setting and this PR only adds repository guards. That changes the retention/cleanup behavior of gh-aw failure issues and is repeated in the other regenerated locks; please preserve the prior value or make the new expiry an explicit, documented source change.
GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168"
.github/workflows/ci-status-net11.lock.yml:1224
- This lock regeneration also changes
GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURSfrom0to168, although the corresponding source workflow has no failure-issue setting and this PR only adds repository guards. That changes the retention/cleanup behavior of gh-aw failure issues and is repeated in the other regenerated locks; please preserve the prior value or make the new expiry an explicit, documented source change.
GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168"
.github/workflows/daily-repo-status.lock.yml:1210
- This lock regeneration also changes
GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURSfrom0to168, although the corresponding source workflow has no failure-issue setting and this PR only adds repository guards. That changes the retention/cleanup behavior of gh-aw failure issues and is repeated in the other regenerated locks; please preserve the prior value or make the new expiry an explicit, documented source change.
GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168"
.github/workflows/regression-corpus-scanner.lock.yml:1332
- This lock regeneration also changes
GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURSfrom0to168, although the corresponding source workflow has no failure-issue setting and this PR only adds repository guards. That changes the retention/cleanup behavior of gh-aw failure issues and is repeated in the other regenerated locks; please preserve the prior value or make the new expiry an explicit, documented source change.
GH_AW_ACTION_FAILURE_ISSUE_EXPIRES_HOURS: "168"
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
|
Implemented the latest review in
The PR description now documents both changes. |
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d00747b7-96f3-4e7a-8dfb-e3a48db04b2d
|
@copilot-pull-request-reviewer addressed the latest feedback in 9535f58: all nine remaining stale gh-aw locks were regenerated with current-main-pinned v0.86.2 strict compilation, so all 14 generated workflows now use the repository-wide 168-hour failure-issue expiry. The compile was idempotent and the PR is MERGEABLE. This is ready for re-review — thanks! |
PureWeen
left a comment
There was a problem hiding this comment.
Adversarial Code Review — 3 independent reviewers with consensus
Verdict: Clean ✅
Three independent reviewers analyzed all 30 changed files (16 non-generated + 14 regenerated locks), tracing job dependency graphs, compiled lock output, and guard coverage. No correctness, security, or regression issues found.
Verified correct
- Dependency cascades — All downstream jobs (e.g.
Mergein merge workflows,build-and-measure/analyze-and-reportin template-size-tracking) are transitively gated vianeedsedges with noalways()override, so a skipped root job correctly cascades. - regression-corpus-scanner restructuring — Moving
needs.pre_activation.outputs.has_candidatesfrom workflow-levelifto theactivationjob-levelifis actually a fix: the old form would have been an invalid self-reference onpre_activationitself. The new structure correctly gatespre_activationwith the repo/ref check while preserving the candidate condition onactivation. - Security model —
github.repositoryis immutable (forks cannot rename todotnet/maui); no TOCTOU betweenifevaluation and runner allocation; environment secrets remain protected. - Lock regeneration — All 14 locks updated to
EXPIRES_HOURS: "168"matchingaw.jsonpolicy; no stale or unexpected drift. - No unguarded scheduled workflows remain — Cross-checked against all
.yml/.lock.ymlfiles withscheduletriggers.
💡 Minor consistency note (2/3 reviewers, non-blocking)
.github/workflows/pr-review-queue.yml:91 — The validate job still uses the old github.repository_owner == 'dotnet' pattern while the sibling generate-report job (line 25) was converted to github.repository == 'dotnet/maui'. Since validate is pull_request-scoped and read-only, this is not a functional or security risk — just an incomplete conversion within a file this PR already edits. Could be aligned for consistency.
Methodology: 3 independent reviewers with adversarial consensus. Findings required 2/3+ agreement to be included.
PureWeen
left a comment
There was a problem hiding this comment.
Adversarial review
No new correctness, security, or regression concerns found at 9535f5823518eb68938697bc7fd0b73f28308cfe.
Three independent reviewers reached adversarial consensus; each independent reviewer assessed the exact head.
Note
Are you waiting for the changes in this PR to be merged?
It would be very helpful if you could test the resulting artifacts from this PR and let us know in a comment if this change resolves your issue. Thank you!
Summary
dotnet/mauirepositorypre_activationjobs so forks cannot reach PAT selection or Copilot inferenceWhy
Forks that enable GitHub Actions inherit scheduled workflows from this repository. Without repository guards, those schedules can consume fork owner Actions minutes and Copilot credits even when the fork is otherwise idle.
Every scheduled workflow now has an upstream-only condition on each root job. A scheduled run recorded by GitHub in a fork therefore contains only skipped jobs and consumes no runner or inference work.
Manual
workflow_dispatchruns can select an arbitrary ref, so the regression scanner trusted-main restriction also coverspre_activation, where checkout and deterministic PowerShell execute withGH_TOKENbefore agent activation.Current-main gh-aw defaults action-failure issues to a seven-day lifetime.
.github/workflows/aw.jsonrecords that policy explicitly so regenerated locks do not introduce an undocumented retention change.Validation
--validate --no-check-updateFind-RegressionFixPRsPester tests