Interview Prep/GitHub Actions/Triggers & Events

Why does `github.event.inputs.dry_run == true` never match, while `inputs.dry_run` works?

IntermediateConceptTriggers & Events
Answer

github.event.inputs comes from the webhook payload where every value is a string, so the boolean input is 'true' (a string). inputs.dry_run preserves the declared type and is a real boolean. Comparing a string to a boolean with == coerces both to numbers ('true' becomes NaN), so the comparison is false. Use inputs.dry_run or compare github.event.inputs.dry_run == 'true'.

All GitHub Actions questions Roadmap: GitHub Actions

More on Triggers & Events