Actions with trigger `on: release` not triggered with tags created by automation

Summary

A workflow with trigger: on: release does NOT fire, even when releases are created by a user explicitly BUT the related tags were created by automation.

What I can see

Given a workflow “X” has trigger on: release like this:

# Workflow X
on:
  release:
    types: [published, created, released]
case who created the tag who created the release workflow X triggered
1 Another workflow Another workflow NO
2 Another workflow Me on the Web UI NO:thinking:
3 Me on the Web UI Me on the Web UI YES
4 Me from CLI Me on the Web UI YES

What I expect

"Case 2" SHOULD trigger the workflow “X”.

Is “case 2” expected behavior?

1 Like

Here are just my assumption:

  • I assume a flag which means “this is created by automation” is added to tag itself.
  • Then even when a user created a release on that tag, workflow X doesn’t be triggered.

Any feedback, ideas, or help would be appreciated. Thank you in advance.

@otiai10,

If you want to trigger a workflow runs on the release event, you need to understand few points below:

  1. The Git ref (github.ref) of the release is a tag that created from a commit (github.sha) on a branch. The workflow file should be existing on this tagged commit.

  2. When you create the release in the workflow, such as using the “create-release” action or the “Create a release” API, don’t use the GITHUB_TOKEN to authenticate if you want the release creation can trigger the workflow. You should create a personal access token to authenticate.

Thank you for reply, @brightran.

  1. Yes, the commit hash includes the workflow file.
  2. Seems you didn’t get my question. I am NOT trying to trigger a workflow from another.

What I’m trying is to trigger a workflow when I publish a release from Web UI.

Any further input will be appreciated. Thanks

@otiai10,

OK, now I have got your meaning:
You use a workflow to create and push a tag to your GitHub repository, then you manually create a release with this new tag. What you expect is that this new release should trigger another workflow runs on release event. But for some reasons, this workflow is not triggered.

I also tested as like this, but did not reproduce the problem. I created a tag authenticating with the GITHUB_TOKEN in a workflow, then manually create a release with this tag, another workflow was triggered as expected on the release event.
Below are the two workflows I tested:

If possible, can you share your repository with us, and specify the tag, the release and the workflows, so that we can check more detailed information to analyze the root cause.

Thank you for testing. It sounds wierd.

This is the repository I’m working on:

Thanks to your reproducing, now I’m doubting that the latest tag I tested was including the latest version of workflow yaml… the exactly what you pointed in previous post. Let me check…

You might be right.
I’ll try to solve this problem by following your advice and will update you if it’s fixed…

Thank you so much @brightran

@otiai10,

now I’m doubting that the latest tag I tested was including the latest version of workflow yaml… the exactly what you pointed in previous post.

I have checked the latest tag ‘3.0.0-alpha.77’ in your repository, and I can confirm that this tag indeed does not include any workflow which runs on the release event.

According to your above reply,

a workflow which should trigger with release: https://github.com/KanCraft/kanColleWidget/blob/cc050d2fb6b8ffdc1f0647fb606998835043dbaf/.github/workflows/webstore-prod.yml#L2-L11

the workflow you want to trigger on the release event is “.github/workflows/webstore-prod.yml” (name: Web Store PRODUCTION).
In this workflow file, it should include the event settings like as below.

on: release

OR

on:
  release:
    types: [published, created, released, <some other types>]

But on the latest tag ‘3.0.0-alpha.77’, the event settings in “.github/workflows/webstore-prod.yml” does not include the release event (see here):

on:
  push:
    branches:
      - release

We can see, you only set a push event with the branches filter, no release event.
I also checked other workflow files on this tag, contrib-notice.yml, javascript-ci.yml and webstore-stage.yml. None of them include the release event.

So, it is correct behavior that no any workflow was triggered by the release event on the tag ‘3.0.0-alpha.77’.

1 Like

You are completely right.
This problem cannot be reproduced when I update all the things.

Sorry for my misunderstanding, and thank you very much!!!

You’re welcome @otiai10 , and glad that my suggestions can help you solve the problem.