Skip to content
Discussion options

You must be logged in to vote

Yeah this is a known gotcha. act doesn't automatically pick up github.ref from your event.json the way you'd expect.

The --eventpath flag populates github.event.* fields, but github.ref and github.sha come from a different place — act infers them from your local git state or its own defaults, not from the event payload.

What actually works: pass the branch explicitly with -b:

act push -b feature/my-branch

This sets github.ref to refs/heads/feature/my-branch properly, and your if: github.ref == 'refs/heads/main' will correctly skip the deploy step.

If you want to be extra safe for local testing, you can also add a second guard in the workflow itself:

- name: Deploy
  if: github.ref == 'ref…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by centranoisacs
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants