Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for filtering kosli log environment events by one or more repositories via a new --repo flag, producing repeated query parameters in the request URL.
Changes:
- Add
--repoflag tolog environmentand appendrepo_namequery parameters to the events API request. - Extend command help/usage examples to document repo-filtered event listing.
- Expand the test suite setup and add new test cases covering repo filtering.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| cmd/kosli/logEnvironment.go | Adds --repo flag plumbing and appends repo_name query parameters when fetching environment events. |
| cmd/kosli/logEnvironment_test.go | Enhances test setup with repo-related context and adds test cases for --repo filtering behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
jbpros
reviewed
Feb 9, 2026
cmd/kosli/logEnvironment.go
Outdated
| func (o *logEnvironmentOptions) getEnvironmentEvents(out io.Writer, envName, interval string) error { | ||
| eventsURL := fmt.Sprintf("%s/api/v2/environments/%s/%s/events?page=%d&per_page=%d&interval=%s&reverse=%t", | ||
| global.Host, global.Org, envName, o.pageNumber, o.pageLimit, url.QueryEscape(interval), o.reverse) | ||
| baseURL := fmt.Sprintf("%s/api/v2/environments/%s/%s/events", global.Host, global.Org, envName) |
Contributor
There was a problem hiding this comment.
We're still doing some unsafe string manipulation here.
Something like this would be safe, I think?
u, err := url.Parse(global.Host)
if err != nil {
return fmt.Errorf("failed to parse host URL: %w", err)
}
u.Path, err = url.JoinPath(u.Path, "/api/v2/environments", global.Org, envName, "events")
if err != nil {
return fmt.Errorf("failed to join URL path: %w", err)
}
jbpros
approved these changes
Feb 9, 2026
jbpros
approved these changes
Feb 9, 2026
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 change adds the
--repoflag to thelog environmentcommand, and filter the query by repo.The flag can be repeated, which will result in a repeated query parameter in the requested url.