Repository navigation
Parenthesize agentic-workflow fork guards to emit valid YAML - #130338
Merged
Merged
Conversation
The workflow-level `if:` fork guard is applied to the generated `pre_activation` job. A single-term `!github.event.repository.fork` guard was emitted inline as `if: !github.event.repository.fork`, which is invalid YAML because a leading `!` is a tag indicator. - ci-failure-fix, ci-failure-scan, ci-failure-scan-feedback, code-review: change the guard to `if: (!github.event.repository.fork)` and recompile - shared/pat_pool.README.md: document the fork-guard gotcha under Known Issues Co-authored-by: Copilot <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates several agentic workflow frontmatter fork guards so the compiled *.lock.yml workflows remain valid YAML when gh aw compile inlines the workflow-level if: onto the generated pre_activation job.
Changes:
- Updated workflow-level fork guards in affected
*.mdworkflows toif: (!github.event.repository.fork)(avoids YAML tag parsing of leading!after compilation). - Recompiled the corresponding
*.lock.ymlfiles sopre_activation.ifno longer begins with!github.event.repository.fork. - Documented the issue and the required workaround in
shared/pat_pool.README.md.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/shared/pat_pool.README.md | Documents the pre_activation + fork-guard/YAML-tag pitfall and the parentheses workaround. |
| .github/workflows/code-review.md | Updates workflow-level fork guard to a parenthesized expression. |
| .github/workflows/code-review.lock.yml | Recompiled output reflecting the updated fork-guard shape in generated jobs. |
| .github/workflows/ci-failure-scan.md | Updates workflow-level fork guard to a parenthesized expression. |
| .github/workflows/ci-failure-scan.lock.yml | Recompiled output; pre_activation.if is now YAML-safe. |
| .github/workflows/ci-failure-scan-feedback.md | Updates workflow-level fork guard to a parenthesized expression. |
| .github/workflows/ci-failure-scan-feedback.lock.yml | Recompiled output; pre_activation.if is now YAML-safe. |
| .github/workflows/ci-failure-fix.md | Updates workflow-level fork guard to a parenthesized expression. |
| .github/workflows/ci-failure-fix.lock.yml | Recompiled output; pre_activation.if is now YAML-safe. |
jeffhandley
enabled auto-merge (squash)
July 8, 2026 08:28
vitek-karas
approved these changes
Jul 8, 2026
eiriktsarpalis
pushed a commit
that referenced
this pull request
Jul 15, 2026
## Summary
Several agentic workflows guard against running in forks with a
workflow-level `if:` fork guard. When the guard is a single-term
expression, `gh aw compile` applies it to the generated `pre_activation`
job and emits it inline as `if: !github.event.repository.fork`. A
leading `!` is a YAML tag indicator, so the compiled `.lock.yml` is
invalid YAML and GitHub rejects the workflow (`could not determine a
constructor for the tag '!github.event.repository.fork'`).
Wrapping the expression in parentheses makes both the source frontmatter
and the emitted `pre_activation` condition start with `(` instead of
`!`, producing valid YAML with identical evaluation. The `${{ }}`
wrapper is redundant (`gh aw compile` strips it) and is dropped,
matching `breaking-change-doc.md`, which already omits it.
## Changes
- `ci-failure-fix.md`, `ci-failure-scan.md`,
`ci-failure-scan-feedback.md`, and `code-review.md`: fork guard is now
`if: (!github.event.repository.fork)`, with `.lock.yml` files recompiled
via `gh aw compile --schedule-seed dotnet/runtime`.
- `shared/pat_pool.README.md`: new "Fork guards must be wrapped in
parentheses" entry under Known Issues, since the bug only surfaces on
the `pre_activation` job created by the PAT-pool `on.permissions: {}`
workaround.
`ci-failure-fix`, `ci-failure-scan`, and `ci-failure-scan-feedback` were
emitting invalid lock files. `code-review` was valid at runtime (its
`pull_request` trigger produces a compound, already-parenthesized guard)
but is updated for consistency.
> [!NOTE]
> This pull request was prepared by GitHub Copilot CLI on behalf of
@jeffhandley.
Co-authored-by: Copilot <[email protected]>
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Several agentic workflows guard against running in forks with a workflow-level
if:fork guard. When the guard is a single-term expression,gh aw compileapplies it to the generatedpre_activationjob and emits it inline asif: !github.event.repository.fork. A leading!is a YAML tag indicator, so the compiled.lock.ymlis invalid YAML and GitHub rejects the workflow (could not determine a constructor for the tag '!github.event.repository.fork').Wrapping the expression in parentheses makes both the source frontmatter and the emitted
pre_activationcondition start with(instead of!, producing valid YAML with identical evaluation. The${{ }}wrapper is redundant (gh aw compilestrips it) and is dropped, matchingbreaking-change-doc.md, which already omits it.Changes
ci-failure-fix.md,ci-failure-scan.md,ci-failure-scan-feedback.md, andcode-review.md: fork guard is nowif: (!github.event.repository.fork), with.lock.ymlfiles recompiled viagh aw compile --schedule-seed dotnet/runtime.shared/pat_pool.README.md: new "Fork guards must be wrapped in parentheses" entry under Known Issues, since the bug only surfaces on thepre_activationjob created by the PAT-poolon.permissions: {}workaround.ci-failure-fix,ci-failure-scan, andci-failure-scan-feedbackwere emitting invalid lock files.code-reviewwas valid at runtime (itspull_requesttrigger produces a compound, already-parenthesized guard) but is updated for consistency.Note
This pull request was prepared by GitHub Copilot CLI on behalf of @jeffhandley.