Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
| "github.event.project_card.id", | ||
| "github.event.project_column.id", | ||
| "github.event.pull_request.number", | ||
| "github.event.pull_request.base.ref", |
There was a problem hiding this comment.
Removed in commit 7a4d0ec. The unsafe expression has been removed from the allowed list, and the changeset generator workflow has been reverted to run for all PRs without the base branch restriction.
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
|
@copilot keep if expression using base.ref. It is safe to use any expression there since it is not passed to the agent. The "if" does not need to be sanitized. |
|
@copilot update instructions.md to specify that "if" expressions can use any expression. Only restriction when inlined in the prompt as ${{}} expression. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Restored in commit d8a5f72. The |
|
@copilot update prompt to treat any internal, tooling change or documentation change as "patch" level only. |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Updated in commit 6f8e891. The changeset generator prompt now explicitly treats internal changes, tooling changes, and documentation changes as "patch" level only.
Updated in commit 6f8e891. The instructions now clarify that |
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Overview
This PR restricts the changeset generation agentic workflow to run only for pull requests where the base branch is the repository's default branch. This prevents the workflow from running on PRs targeting feature branches, staging branches, or other non-default branches.
Changes
1. Added New Allowed GitHub Actions Expression
Added one new expression to the allowed list in
pkg/constants/constants.go:github.event.repository.default_branch- Provides access to the repository's default branch nameThis expression is now validated as safe for use in agentic workflow markdown content.
2. Updated Changeset Generator Workflow
Modified
.github/workflows/changeset-generator.mdto include anifcondition in the frontmatter:This condition ensures the workflow only executes when the PR's base branch matches the repository's default branch.
Additionally, updated the changeset type determination logic to explicitly treat internal changes, tooling changes, and documentation changes as "patch" level only. This ensures consistent versioning for non-user-facing changes.
3. Workflow Compilation
The compiled workflow (
.github/workflows/changeset-generator.lock.yml) now includes this restriction in the activation job'sifcondition, combined with the existing team membership check:4. Updated Documentation
Updated
.github/instructions/github-agentic-workflows.instructions.mdto clarify that:iffield in frontmatter can use any GitHub Actions expression${{}}expressions embedded in markdown content that gets passed to the AI agentThis documentation clarifies the security model and helps developers understand when expression sanitization is required.
Security Note
The
ifcondition in the frontmatter can safely usegithub.event.pull_request.base.refbecause it's evaluated by GitHub Actions itself and not passed to the AI agent. The allowed expressions list inconstants.goonly applies to expressions in the markdown content that gets sent to the agent. This maintains proper security boundaries:ifconditions: Can use any GitHub Actions expression (evaluated by GitHub Actions)Behavior
Before: The changeset generator workflow ran for all pull requests marked as "ready for review", regardless of the target branch.
After: The workflow only runs when:
Additionally, the workflow now consistently categorizes internal, tooling, and documentation changes as "patch" level.
Example Scenarios:
feature-branch→main(default): Workflow runsfeature-a→staging: Workflow skipsfeature-b→develop: Workflow skipsTesting
Impact
This change prevents unnecessary changeset generation for PRs that target non-default branches, which is appropriate since changesets are typically only needed when merging to the main release branch. The updated changeset categorization logic ensures that internal and documentation changes are versioned consistently as patches.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.