Workflow fails w/ "Unknown Event", when unexpectedly(!) getting a merge commit for a deployment event

I am creating a deployment event inside an action (using avakar/create-deployment). Another workflow is listening for that event and performs the actual deployment. That works just fine on the repo’s main branch.

However, for preview deployments of PRs, this does not work. Although the event is created with auto_merge being false (double checked using debug logs!), and the feature branch not being behind the main branch, the event always seems to refer to a newly generated merge commit (which is identical to the feature branch commit).

This somehow causes the second workflow (with on: deployment) to fail, with “Unknown event” / “Unnamed workflow”, as apparently Github is somehow not able to use the workflow when that commit is not part of a branch/tag:

As you can see in the 2nd screenshot there is a merge commit, which shouldn’t be the case AFAIU. Also the error is quite cryptic…

Any ideas? :thinking:


The commit ‘b322e93…’ in your case is a pull request merge commit on the pull request merge branch of the PR.
The PR merge branch likes a temporary and transitionary branch used for the merges between two actually existing branches in the repository.
The PR merge branch will not be actually created in the repository, and the merge commit on the PR merge branch also is not an actually existing commit in the repository.

As you have seen form the error message, the commit which can trigger the deployment event should be an actually existing commit that is referenced by a branch or tag in current repository, or is either an orphaned commit or from a fork of this repository.

At GitHub we often deploy branches and verify them before we merge a pull request.

Thanks @brightran, this was very helpful!

This seems to work fine now. For the record, I was using avakar/create-deployment to trigger the deployment event (on: pull_request), and instead of using the default behavior I override the ref of the event with ref: ${{ github.head_ref }}. The action that listens on on: deployment runs fine now.


Yeah, set the ref as the head branch or the lasted commit on the head branch is a good choice.