Conversation
…outputs - Replace strconv.Itoa + %s with %d format verb in domains_command.go - Remove intermediate count variable in RunListDomains - Remove redundant && safeOutputsToken != "" condition in computeEffectiveProjectToken - Drop unused strconv import Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR simplifies two recently introduced code paths to remove unnecessary temporary variables and redundant checks while preserving behavior.
Changes:
- Simplifies
gh aw domainsconsole output by removingstrconvusage and redundantlen(...)intermediates. - Simplifies
computeEffectiveProjectTokenfallback logic by removing a redundant empty-string guard and clarifying variable naming.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pkg/workflow/compiler_safe_outputs_steps.go | Simplifies project token fallback logic without changing precedence/behavior. |
| pkg/cli/domains_command.go | Simplifies workflow/domain count formatting and removes now-unneeded strconv import. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
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.
This PR simplifies recently modified code from PRs #21086 and #21083 to improve clarity and remove unnecessary intermediaries while preserving all functionality.
Files Simplified
pkg/cli/domains_command.go— removedstrconvimport and redundant temp variablespkg/workflow/compiler_safe_outputs_steps.go— simplified token fallback logicImprovements Made
1. Eliminated unnecessary
strconv.Itoaconversionsstrconv.Itoawas used to format integers as strings only to pass them as%stofmt.Fprintf. Using%ddirectly is cleaner, removes two intermediate variables, and drops thestrconvimport entirely.2. Removed redundant
counttemporary variableThe
countvariable was only used twice immediately after assignment — directly accessinglen(summaries)is clearer.3. Simplified token fallback in
computeEffectiveProjectTokenThe
&& safeOutputsToken != ""guard is redundant: assigning an empty string to an already-empty variable is a no-op. Removing it and renamingconfigToken→tokenmakes the intent clearer.Changes Based On
Recent changes from:
gh aw domainscommand to list network domains configured in workflows #21086 —Add gh aw domains command to list network domains configured in workflowssafe-outputs.allowed-url-domainsfor additive URL domain allowlisting #21083 —Add safe-outputs.allowed-url-domains for additive URL domain allowlistingTesting
pkg/clitests pass (go test ./pkg/cli/...)make build)make fmt)References: §23116938699