Skip to content

Why does my workflow always run on `main` even though I set `ref`?

No, nothing is wrong on the Testomat.io side. This is how the GitHub Actions API works.

When a workflow_dispatch is triggered through the API, GitHub treats two things separately:

{
"ref": "your-branch",
"inputs": { "run": "...", "grep": "..." }
}
  • ref is GitHub’s own parameter, it decides which branch the workflow runs on.
  • inputs are the user-defined values you declared in your workflow file.

Testomat.io sends ref correctly as a top-level parameter, so GitHub does start the workflow from your branch. But GitHub consumes ref before the workflow begins, and it never passes it into inputs. So if your workflow reads ${{ inputs.ref }}, it gets the default, because inputs.ref is a separate field that doesn’t exist unless you declare it yourself.

To refer to the branch inside your workflow, use GitHub’s built-in context variable instead of an input:

${{ github.ref_name }}

This always reflects the branch the workflow is actually running on, no matter how it was triggered.