Repository navigation
fix(ci): honor the dry_run input in the weekly-digest workflow - #15
Merged
Merged
Conversation
The workflow_dispatch input `dry_run` is declared `type: boolean`, so `inputs.dry_run` is a real boolean. The publish step compared it with the string 'true'. GitHub's expression engine converts both sides to numbers for that comparison (true is 1, 'true' is NaN), so it was always false. A manual run with "Dry run (preview only)" checked ran `herald publish` without `--dry-run` and posted to Discord, and to X and LinkedIn when those secrets are set. Pass the flag from the boolean directly, and also set HERALD_DRY_RUN from it so the CLI's own setting enforces the dry run if the flag is ever lost. Scheduled runs have no inputs, so they still post the weekly digest. Add tests/test_workflows.py, which fails if any workflow compares a boolean input with a quoted string, and checks that the publish step passes dry run to herald both ways. Ledger: B249 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
GitHub evaluates an `if:` value as an expression even without `${{ }}`
around it, so `if: inputs.dry_run == 'true'` has the same always-false
bug. The workflow check only scanned `${{ }}` blocks and missed it.
Scan bare `if:` values too, and add a test that runs the finder on an
inline workflow with each comparison form, so the check cannot silently
stop detecting them.
Ledger: B249
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.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.
Running the weekly-digest workflow by hand with Dry run (preview only) selected still posted to Discord, and to X and LinkedIn when those secrets were set. The workflow compared the boolean
dry_runinput with the string'true', which GitHub Actions always evaluates as false, soherald publishnever got--dry-run. The workflow now uses the boolean directly and also setsHERALD_DRY_RUN, so a dry run stays preview-only.Fixes
inputs.dry_run == 'true'. For atype: booleaninput,inputs.dry_runis a boolean, and GitHub Actions converts both sides of that comparison to numbers (trueis 1,'true'is NaN), so the result was always false and--dry-runwas never passed..github/workflows/release-announce.ymlpasses${{ inputs.dry_run && '--dry-run' || '' }}and setsHERALD_DRY_RUNfrom the same input, so the CLI's own setting also enforces the dry run. Scheduled runs have no inputs, so they get no flag andHERALD_DRY_RUN=false, and still post the weekly digest.tests/test_workflows.py:test_boolean_inputs_are_not_compared_with_strings,test_publish_step_passes_dry_run_to_herald. Two more tests,test_release_announce_declares_dry_run_as_booleanandtest_string_comparison_check_covers_every_expression_form, make sure the check still finds boolean inputs and every comparison form, including bareif:conditions.Not fixed here
gh apiquery fails, so digests and release posts include no releases; X and LinkedIn posts are cut mid-word at the length limit; the README install command names a package that isn't on PyPI; and re-running after a partial failure posts again on platforms that already succeeded. These are scheduled after feat: addherald postto post approved text to X verbatim #14 merges, because feat: addherald postto post approved text to X verbatim #14 also changes the README and how herald posts to X. (B250)How it was tested
test_boolean_inputs_are_not_compared_with_strings[release-announce.yml]andtest_publish_step_passes_dry_run_to_heraldfail onmainand pass on this branch.Both expressions were evaluated with GitHub's
@actions/expressionsevaluator (0.3.61):inputs.dry_runHERALD_DRY_RUNtrue--dry-runtruefalsefalsefalseIf the input ever arrived as the string
'false'instead of a boolean, the new expression would add--dry-run, so the failure mode is a skipped post, not an unintended one.Full suite: 81 passed on Python 3.12. The workflow tests also pass on Python 3.10.
ruff check .passes, anduv buildbuilds the sdist and wheel.actionlintreports nothing on the changed lines. Its four SC2086 shellcheck notes on the "Determine content type" step are also onmain.actionlintdoesn't catch the original comparison, so the new test is what guards against it.🤖 Generated with Claude Code