Skip to content

Workflow: browser default and tags input for Run tests - #196

Merged
aguspe merged 2 commits into
masterfrom
feat/workflow-dispatch-inputs
Nov 14, 2026
Merged

aguspe merged 2 commits into
masterfrom
feat/workflow-dispatch-inputs

Conversation

@aguspe

@aguspe aguspe commented Nov 14, 2026

Copy link
Copy Markdown
Collaborator

Lets a project generated by raider be started from Raider Hideout's Run tests (workflow_dispatch on test_pipeline.yml), with or without tags.

What changes in lib/generators/infrastructure/templates/github.tt

  • browser input: required: false, default: chrome. A dispatch with no inputs now uses chrome (GitHub uses the default when an input is omitted).
  • New optional tags input (type: string, default ''): RSpec tags separated by commas or spaces, each passed to rspec as --tag. smoke, @smoke (RSpec strips the @), smoke, fast (either tag), ~slow (exclude), !slow (rewritten to ~slow), type:api (tag with a value).
  • Empty or missing tags run exactly today's command. On push and pull_request inputs.tags is ''; blank or comma/space-only input leaves the args array empty, and "${tag_args[@]}" expands to nothing.

Shell injection guard

  • The input reaches the step only as the TAGS env var (TAGS: ${{ inputs.tags }}); no ${{ }} appears inside run:, so GitHub never pastes the value into the script.
  • The whole value must match ^[A-Za-z0-9@_:,.~! -]{0,200}$ (Hideout's own charset; no newline, tab, quotes, $, ;, backticks, *, /).
  • read -r -a splits it on whitespace with no glob or command expansion; every expansion is quoted.
  • Each tag must match ^[~!]?@?[A-Za-z0-9_][A-Za-z0-9_.-]*(::?[A-Za-z0-9_.-]+)?$, so it can't start with - and is always the argument of --tag.
  • Anything else fails the step with exit 2 and an ::error:: line before rspec starts. It never falls back to all tests.

Scope

  • rspec + selenium is the only combination that renders test_pipeline.yml (Cucumber and Watir were removed in 4.0.0), so there is no Cucumber --tags variant.
  • Azure (azure_pipelines.tt, no dispatch inputs; Hideout dispatches GitHub only) and Appium (appium_pipeline.yml) are unchanged. Hideout's Tag input should stay blank for mobile projects: GitHub answers an unknown input with a 422.
  • Generated README: one paragraph under Running in CI (web projects only).
  • RELEASE.md: ### 4.3.0 (unreleased) with the change and how an existing project updates its workflow by hand. The number is a pick; rename it at release. lib/version stays 4.2.0.

Verification

  • Full rspec (includes spec/utilities and spec/generators): 2281 examples, 0 failures, 10 pending. rspec spec/generators/: 312/0. rubocop: no offenses. reek .: 0 warnings. steep: no type errors.
  • New content specs run the rendered script with bash and a stub bundle that records its argv: blank, unset and ' , ,' give today's argv; 9 tag cases give the expected --tag args; 20 hostile or invalid values ($(touch pwned), backticks, ;, &&, *, quotes, -r x, newline, tab, a!b, ~, a:, 201 chars, ...) exit 2 without calling bundle and without creating the file. Locally this runs on macOS bash 3.2; the Content validation job runs it on ubuntu's bash 5.
  • Throwaway project generated from the branch (rbenv 3.4.12, scratch GEM_HOME): actionlint 1.7.12 with shellcheck reports 0 errors on the rendered test_pipeline.yml and on the unchanged appium_pipeline.yml. In that project, rspec --dry-run on a probe spec selects 1 example for --tag @smoke, 2 for --tag smoke --tag slow, 3 for --tag ~slow and --tag ~@slow, 1 for --tag type:api; raider-reporter exec -- passes the tags through.
  • Whole-branch Opus review: no blocking findings. Fixed: the spec now unsets an inherited TAGS and runs in a temp dir; a tag allows one :value (so a: and a:b:c are refused instead of silently matching nothing). Not changed: tags are checked in the Run tests step, after setup, so a value Hideout accepts but this check refuses (a!b, a lone ~) fails after setup minutes rather than before.

The generated test_pipeline.yml can now be dispatched with no inputs
(browser defaults to chrome and is no longer required) and takes an
optional tags input, passed to rspec as one --tag per comma- or
space-separated tag. Blank tags run all tests exactly as before.

The input reaches the step only through the TAGS env var; the whole
value and each tag are checked against tag-like patterns before rspec
starts, and anything else fails the step with exit 2.
@aguspe
aguspe marked this pull request as ready for review November 14, 2026 23:22
@aguspe
aguspe merged commit 1406324 into master Nov 14, 2026
17 checks passed
@aguspe
aguspe deleted the feat/workflow-dispatch-inputs branch November 14, 2026 23:28
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.

1 participant