fix: use fromJSON for numeric comparison in auto-approval condition#198
Open
marcusburghardt wants to merge 1 commit intocomplytime:mainfrom
Open
fix: use fromJSON for numeric comparison in auto-approval condition#198marcusburghardt wants to merge 1 commit intocomplytime:mainfrom
marcusburghardt wants to merge 1 commit intocomplytime:mainfrom
Conversation
GitHub Actions >= operator performs lexicographic string comparison
when both operands are env context strings, causing '117' >= '24'
to evaluate as false ('1' < '2' in ASCII). Wrap both operands in
fromJSON() to force numeric casting: fromJSON('117') >= fromJSON('24')
correctly evaluates as 117 >= 24 = true.
Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: Marcus Burghardt <maburgha@redhat.com>
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.
Summary
Fix the dependabot auto-approval condition that silently fails on every PR due to lexicographic string comparison instead of numeric comparison.
GitHub Actions
>=operator performs lexicographic string comparison when both operands come from theenvcontext (both are strings). This causes"117" >= "24"to evaluate asfalsebecause'1' < '2'in ASCII order — even though numerically117 >= 24istrue.The fix wraps both operands in
fromJSON()to force numeric casting:fromJSON(env.RELEASE_AGE_HOURS) >= fromJSON(env.MIN_RELEASE_AGE_HOURS)fromJSON(needs...release_age_hours) >= fromJSON(env.MIN_RELEASE_AGE_HOURS)Impact: Without this fix, no dependabot PR can be auto-approved because the release age comparison always fails. This affects all org repos consuming
ci_dependencies.yml.Evidence: PR #197 (
actions/upload-artifact7.0.0 → 7.0.1) meets all criteria (risk=low, review=success, release_age=117h) but the auto-approve step was skipped.Related Issues
Review Hints
.github/workflows/ci_dependencies.yml(2 lines)fromJSON()wrappers added: one in the stepif:condition (L91), one in the PR comment auto-approval display (L67)MIN_RELEASE_AGE_HOURSenv constant remains centralized (Principle I) — only the comparison method changed