Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 1 of 6

[GitHub Actions] New workflow, the On event filter for create: tags: <wildcard>

I have two git tag forms v/release/1.0.0 and v/beta/1.0.0, with following two workflow define:

 

on:
  create:
    tags:
      - v/release/*

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu

    steps:
      run: npm publish --tag=latest

 

and

 

on:
  create:
    tags:
      - v/beta/*

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu

    steps:
      run: npm publish --tag=next

 

I would expect the two workflows isolated by its tag filters, but seems not, am I doing it wrong?

 

5 Replies
Copilot Lvl 3
Message 2 of 6

Re: [GitHub Actions] New workflow, the On event filter for create: tags: <wildcard>

I've been struggling to figure how how to filter by tags as well, but so far as I can tell, wildcarding just doesn't work at all against tags :scream:

 

I've been trying variations of 

on:
  create:
    tags:
      - v*.*.*-beta.*

Every tag push is triggering all our different environments though, I can't figure out the right way to do it.

Copilot Lvl 3
Message 3 of 6

Re: [GitHub Actions] New workflow, the On event filter for create: tags: <wildcard>

It looks like we're going to have to use the old style bin/filter to get tag filtering work like we're wanting. It's just a shame to spin up all those unneccessary instances just to filter against a tag

 

name: 'deploy:beta'
on:
  create:
    tags:
      - v*.*.*-beta.*
    branches:
      - 'refs/tags/*'
      - '!refs/heads/*'

jobs:
  filter:
    name: 'deploy:beta:filter'
    runs-on: ubuntu-latest
    steps:
      -
        uses: actions/bin/filter@master
        with:
          args: tag v*.*.*-beta.*

  build:
    needs:
      - filter
    name: 'deploy:beta:build'
    runs-on: ubuntu-latest
    steps:
      -
        uses: actions/checkout@v1
        with:
          fetch-depth: 1
...

Hopefully someone else can chime in and explain how to do it better

Community Manager
Message 4 of 6

Re: [GitHub Actions] New workflow, the On event filter for create: tags: <wildcard>

Thanks for reaching out. You should be able to use the `push` event for tags and filter the way you want. Can you try this and see if it works?

 

on:
  push:
    tags:
      - v/release/*

jobs:
  deploy:
    name: Deploy
    runs-on: ubuntu

    steps:
      run: npm publish --tag=latest

Let us know!

Copilot Lvl 2
Message 5 of 6

Re: [GitHub Actions] New workflow, the On event filter for create: tags: <wildcard>

Unfortunately it doesn't work lee-dohm.

It will always triggerd!

 

I found a way (thanks to this blog post).

Simply use the`if` configuration.

Copilot Lvl 2
Message 6 of 6

Re: [GitHub Actions] New workflow, the On event filter for create: tags: <wildcard>

This is a major pain-point right now.

 

There is no simple way to filter `v1.0.0` from `v1.0.0-beta0` etc.