question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GitHub Actions Not Respecting Trigger "On Create Tags"

See original GitHub issue

Describe the bug I have two github workflows, one that fires when pushing a branch to master. And another that fires only when a tag is created. However, I am itermittently seeing my tags workflow fire, even when I push a branch. This doesn’t always happen, it only happens ocassionally and generally it follows the tag creation rule. However, this is our production github workflow, and we simply cannot have a branch push cause that action to fire. What gives?

Note, I had also created this issue here: https://github.com/actions/virtual-environments/issues/2898

To Reproduce Steps to reproduce the behavior:

  1. Create a github actions workflow that fires on:
on:
  create:
    tags:
      - v*
  1. Push a branch up to the repo, don’t create a tag. The workflow fires. This is itermittent and can’t always be replicated. So I’m perplexed here. It happens often enough to be a problem.

Expected behavior I would only expect this github action to fire when I create a tag named v1.0.0 or v1.0.1 or vAnything

Runner Version and Platform

Version of your runner? This is happening live on GitHub.com not a local runner

OS of the machine running the runner? OSX/Windows/Linux/…

What’s not working?

When a github action fires, the on part of the workflow.

Job Log Output

N/A

Runner and Worker’s Diagnostic Logs

N/A

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

50reactions
ChristopherHXcommented, Mar 28, 2021

Hi, If I understand the documentation correctly, it states that the branch and tag filter are only supported for push and pull_request events. Althought it isn’t a yaml schema error, it seems to ignore branch and tag filter for all other events like create.

I made a simple workflow which only runs if you create a tag. All other create events are skipped. At least it skips create branch events.

# This is a basic workflow to help you get started with Actions

name: prod-sample

# Controls when the action will run. 
on:
  # Triggers the workflow on push or pull request events but only for the main branch
  create:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    if: ${{ startsWith(github.ref, 'refs/tags/v') }}
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v2

      # Runs a single command using the runners shell
      - name: Run a one-line script
        run: echo Hello, world

I hope it helps 😃

0reactions
KonradHoeffnercommented, Sep 4, 2022

I am not sure if that produces the same result when the tag is manually created using the GitHub web interface instead of being pushed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Github action not triggering in case of automated tag creation
The Github action triggers just fine in case I create a tag and push it myself from the command line or from Eclipse...
Read more >
Help with Action to run only when tagged : r/github
I found a community forum post (link to an answer) that details how to properly setup the workflow to trigger on tags. The...
Read more >
7 Github Actions Tricks I Wish I Knew Before I Started
#1: How to Use Github Action Triggers; #2: Reusable Workflows with ... For instance, you can build iOS apps even if you do...
Read more >
My GitHub Actions workflows are not starting
The cause of this is that scheduled runs only trigger from the default branch (main). Several triggers behave this way, like a Pull...
Read more >
How To Use GitHub Actions for Deployments When Following ...
In this post, I create a CI/CD pipeline with GitHub actions that deploys to multiple environments. We will start with a basic implementation...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found