8000 enhance: Update PR comment's cost change summary by vdmgolub · Pull Request #3099 · infracost/infracost · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

enhance: Update PR comment's cost change summary #3099

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

Merged
merged 14 commits into from
Jul 1, 2024

Conversation

vdmgolub
Copy link
Contributor
@vdmgolub vdmgolub commented Jun 4, 2024

No description provided.

@vdmgolub vdmgolub self-assigned this Jun 4, 2024
@vdmgolub vdmgolub force-pushed the 8000 enhance/pr-comment-phrasing branch from 3fcd4aa to c53709e Compare June 5, 2024 10:37
@vdmgolub vdmgolub force-pushed the enhance/pr-comment-phrasing branch from c53709e to 1c7c864 Compare June 27, 2024 20:30
@vdmgolub vdmgolub marked this pull request as ready for review June 27, 2024 20:37
@@ -188,11 +188,18 @@ func tableForDiff(out Root, opts Options) string {
continue
}

var usageCost string
if out.Metadata.UsageApiEnabled {
Copy link
Member

Choose a reason for hiding this comment

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

I'm worried that this condition is not sufficient because usage costs can also come from the usage file. Essentially, we only want to show the "-" when usageCostsMessage is the "Usage costs CAN be estimated..." one. It looks like that works out to showing - when !out.Metadata.UsageApiEnabled && out.Metadata.UsageFilePath == "" && !out.Metadata.ConfigFileHasUsageFile

as a sanity check in the API comment I also checked to make sure that both usage costs were zero or not present (I was worried about putting in a "-" and then having the total change not equal baseline change.

@vdmgolub vdmgolub force-pushed the enhance/pr-comment-phrasing branch from 1c7c864 to dc5f235 Compare June 27, 2024 20:49
@vdmgolub vdmgolub force-pushed the enhance/pr-comment-phrasing branch from dc5f235 to bf4f8c3 Compare June 28, 2024 16:33
@vdmgolub vdmgolub requested a review from tim775 June 28, 2024 16:35
formatMarkdownCostChange(out.Currency, project.PastBreakdown.TotalMonthlyUsageCost, project.Breakdown.TotalMonthlyUsageCost, false, true),
formatMarkdownCostChange(out.Currency, project.PastBreakdown.TotalMonthlyCost, project.Breakdown.TotalMonthlyCost, false, false),
formatMarkdownCostChange(out.Currency, project.PastBreakdown.TotalMonthlyBaselineCost(), project.Breakdown.TotalMonthlyBaselineCost(), false, true, false),
formatMarkdownCostChange(out.Currency, project.PastBreakdown.TotalMonthlyUsageCost, project.Breakdown.TotalMonthlyUsageCost, false, true, !usageCostsEnabled(out)),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@tim775 This should also be inverted: when usage costs are disabled, skipIfZero is true, so we'll show dashes for zeros.

@vdmgolub vdmgolub force-pushed the enhance/pr-comment-phrasing branch from ce23a01 to df35f67 Compare June 28, 2024 18:29
@vdmgolub vdmgolub force-pushed the enhance/pr-comment-phrasing branch from df35f67 to e5464b8 Compare June 28, 2024 18:55
@vdmgolub vdmgolub closed this Jun 28, 2024
@vdmgolub vdmgolub reopened this Jun 28, 2024
@vdmgolub vdmgolub merged commit e9ce629 into master Jul 1, 2024
10 checks passed
@vdmgolub vdmgolub deleted the enhance/pr-comment-phrasing branch July 1, 2024 09:37
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
0