Awesome Reviewers

Reviewer · CI/CD

Workflow trigger precision

Write workflow conditions, triggers, and inputs so that automation only runs under the exact intended circumstances, never by accident or on unintended matches.

Instruction

Write workflow conditions, triggers, and inputs so that automation only runs under the exact intended circumstances, never by accident or on unintended matches.

  • Use exact or anchored matching (e.g. startsWith(), equality checks) instead of contains() when parsing comment bodies or other free text for commands. A loose contains(github.event.comment.body, '/land') check will also fire if a comment merely includes a URL containing /land.
  • Choose the most specific event/activity type for a trigger. For example, react to pull_request: [labeled] rather than [opened] when the workflow depends on a label being present, otherwise you create a race between the label being applied and the workflow run.
  • Avoid risky defaults on workflow_dispatch inputs that control releases or other sensitive actions (e.g. don’t default an npm tag input to latest); require an explicit selection so accidental dispatches can’t publish or deploy unintentionally.
  • When a CI step echoes shell-sensitive characters such as backticks, escape them so the message is printed as-is instead of being executed as a command substitution:
- run: |
    git diff --exit-code || (echo "There was a change. Run \`yarn generate-inline-fizz-runtime\` and check in the result." && false)

Applying these checks prevents unintended command execution, accidental releases, and race conditions in CI pipelines.