Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve promotion comment. #31

Conversation

ashvarts
Copy link

Description

Please provide a meaningful description of what this change will do, or is for. Bonus points for including links to related issues, other PRs, or technical references.

Note that by not including a description, you are asking reviewers to do extra work to understand the context of this change, which may lead to your PR taking much longer to review, or result in it not being reviewed at all.

Type of Change

  • Bug Fix
  • New Feature
  • Breaking Change
  • Refactor
  • Documentation
  • Other (please describe)

Checklist

  • I have read the contributing guidelines
  • Existing issues have been referenced (where applicable)
  • I have verified this change is not present in other open pull requests
  • Functionality is documented
  • All code style checks pass
  • New code contribution is covered by automated tests
  • All new and existing tests pass

@ashvarts ashvarts marked this pull request as draft October 21, 2024 18:01
@ashvarts ashvarts force-pushed the sd-770-ux-improvement---promotion-pr-description-to-list-specific-targets branch from 301f819 to 884262f Compare October 21, 2024 19:13
@ashvarts ashvarts marked this pull request as ready for review October 21, 2024 19:14
internal/pkg/githubapi/github_test.go Outdated Show resolved Hide resolved
// returns a slice containing paths in common.
func identifyCommonPaths(promotionPaths []string, targetPaths []string) []string {
if (len(promotionPaths) == 0) || (len(targetPaths) == 0) {
return []string{}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return []string{}
return nil

if (len(promotionPaths) == 0) || (len(targetPaths) == 0) {
return []string{}
}
commonPaths := []string{}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
commonPaths := []string{}
var commonPaths []string

internal/pkg/githubapi/github.go Show resolved Hide resolved
internal/pkg/githubapi/github_test.go Outdated Show resolved Hide resolved
internal/pkg/githubapi/github_test.go Show resolved Hide resolved
continue
}
// strings.HasPrefix is used to check that the target path and promotion path match instead of
// using 'pp == tp' because the promotion path is targetPath + component.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this always true? I'm missing some context about how the paths are built/where they come from so it isn't fully clear to me that this covers all cases.

If this does the job and solves the current issue I'm happy to get it in for now.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ashvarts ashvarts force-pushed the sd-770-ux-improvement---promotion-pr-description-to-list-specific-targets branch from bce2a55 to a2ced16 Compare October 22, 2024 15:20
@ashvarts ashvarts requested a review from hnnsgstfssn October 22, 2024 15:23
hnnsgstfssn
hnnsgstfssn previously approved these changes Oct 22, 2024
Copy link

@hnnsgstfssn hnnsgstfssn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, also fix the lint errors.

@ashvarts ashvarts force-pushed the sd-770-ux-improvement---promotion-pr-description-to-list-specific-targets branch from 0070c89 to 4840d62 Compare October 22, 2024 17:22
@ashvarts ashvarts requested a review from hnnsgstfssn October 23, 2024 13:16
hnnsgstfssn
hnnsgstfssn previously approved these changes Oct 23, 2024
Promotion comment used to list all the values in the 'targetPaths' key,
ignoring the promotionAllow and promotionBlock lists. This PR limits
the comment to only paths that are being promoted.
@ashvarts ashvarts force-pushed the sd-770-ux-improvement---promotion-pr-description-to-list-specific-targets branch from 4840d62 to 5c71edd Compare October 23, 2024 13:24
@ashvarts ashvarts merged commit 33715e7 into main Oct 23, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants