Add a first-class duration input#252
Open
rizaziz wants to merge 1 commit into
Open
Conversation
Adds an optional, typed `duration` input (seconds) that maps to the `--duration` CLI flag, so run length no longer has to be threaded through the free-form `args` string where precedence is unclear. Precedence: the `duration` input wins (replacing any `--duration` already in `args`); else honor `--duration` in `args`; else the documented default of 60 seconds. The input is validated as a positive integer, and the effective duration is echoed to the run log so overrides are visible. Also bumps the action runtime from node20 to node24. Fixes #250
Mayhem Automated Code Testing Report❗ 1 Defects Found
Testing details found at https://app.mayhem.security/forallsecure/mcode-action/mayhemit/39 |
d-dot-one
approved these changes
Jul 17, 2026
d-dot-one
left a comment
There was a problem hiding this comment.
The code looks good. Since I'm not familiar yet with this repo, the only change I would see is to test for the rejection cases (0, negative, fractional, non-numeric) in duration (the existing test only covers a single value of 10).
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.
Closes #250.
Summary
Adds an optional, typed
durationinput (seconds) that maps to the Mayhem CLI--durationflag, so run length no longer has to be threaded through the free-formargsstring — where precedence was unclear and a ref (e.g.long-runs) could silently clobber a value passed viaargs.Precedence
durationinput wins — it replaces any--durationalready present inargs;--durationinargs;60seconds.Details
"0","-5","20m","1.5"are rejected with a clear error; empty = unset).Duration: 1200s (from the 'duration' input).) so overrides are visible — directly addressing the "silently became 4 hours" problem in the issue.dist/rebuilt reproducibly viamake dist-rebuild.README.mdandaction.ymldocument the new input.Also included
Bumps the action runtime from
node20tonode24(action.yml). This is the GitHub Actions runtime and is independent of thenode:20Docker image used to builddist/.Testing
tscbuild,prettierformat-check,eslint,nccpackage, andjestall pass. The existing test already exercisesINPUT_DURATION.