fix(github): parse any configured environment in -e flag#679
Draft
Kiran01bm wants to merge 2 commits into
Draft
Conversation
The PR-comment parser hard-coded -e to staging|production, so apply commands for other configured environments (e.g. qa, load) were dropped as "missing env". Widen the flag to accept any environment name; unknown values still fail closed against allowed_environments downstream.
There was a problem hiding this comment.
Pull request overview
This PR fixes SchemaBot’s PR-comment command parsing so schemabot apply / apply-confirm can accept any configured environment name via -e <env>, instead of only parsing staging or production.
Changes:
- Broaden
environmentRegexto capture any environment token ([a-z0-9][a-z0-9_-]*) after-e. - Add parser tests proving
apply -e qaandapply -e loadare recognized.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/webhook/commands.go | Expands -e parsing to accept arbitrary environment tokens. |
| pkg/webhook/commands_test.go | Adds tests covering custom environment parsing in -e. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Guard the leading-alphanumeric requirement in the environment regex so a future loosening that lets -e swallow a following flag (e.g. --tenant) is caught.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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
The PR-comment parser hard-coded the
-eflag to only matchstagingorproduction. Any other environment defined inallowed_environments/environment_order(e.g. aqaorloadstage) failed to parse, soschemabot apply -e <env>was silently treated as "missing env" andrejected.
planwithout-ealready fans out to all configuredenvironments, so only apply/confirm-style commands were affected.
What
Widen
environmentRegexto accept any environment token(
-e\s+([a-z0-9][a-z0-9_-]*)). The leading-alphanumeric requirement keepsit from swallowing a following flag (e.g.
-e --tenant). Unknown orunowned environments still fail closed downstream via
IsEnvironmentAllowed, so widening the parser does not loosen any safetygate.
Before / after