Repository navigation
fix(action): post the comment before enforcing budget gates - #102
Merged
Merged
Conversation
The budget and budget-delta gates (and a budget in .c3x.toml) ran before the PR comment step and failed the job first, so a pull request that broke a gate got no comment. When a comment will be posted, the Estimate step no longer gates; the comment is posted, then the budget-delta and budget gates run. Pushes, with no comment, gate as before. The currency input now reaches the comment and the baseline through C3X_CURRENCY and --currency. The delta gate message puts the sign before the currency symbol.
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.
Found while building the c3x-demo showcase.
Bugs
--budget(and abudgetin the repo's.c3x.tomlapplies there too), and the Budget delta gate ran before the PR comment step. Either one failed the job first, so the pull requests that most needed a comment got none. The demo had to call the Action twice to work around it.currencywas ignored in comments. Only the Estimate step's log used it. Comments and the base-branch baseline were always USD.$+2781.48/mo.Fix
--budget 0and no--strict..c3x.tomlbudget).strictwas already enforced by the comment step after posting.budget_deltain.c3x.tomlis enforced. The input is only passed when set, because passing0would disable the config value.currencyis passed as--currencyto the baseline and gates, and asC3X_CURRENCYto the comment step (it has no--currencyflag). It's exported only when set.set -uin bash 3.2 (macOS runners).Tested
c3x-demo#17 ran
c3xdev/c3x@fix/action-gates-after-commenton the GPU-cluster change withbudget-delta: "500"andcurrency: EUR, in a single step:Monthly cost increased by €2449.56 (+249.0%)delta exceeds gate — €+2449.56/mo > €+500.00/mo(the released binary; this PR fixes the sign)