Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Ground Controller Lvl 1
Message 11 of 20

Re: How to run GitHub Actions Workflow only for new tags

Does the same apply to branches as well? Because this doesn't work for me:

 

 
on:
  push:
    branches:
      - '*'
 

 

Pilot Lvl 1
Message 12 of 20

Re: How to run GitHub Actions Workflow only for new tags

It does apply to branches, but if your branch might include / then you need to match on that too (for as many levels as you may have - */*, */*/*, */*/*/* etc.) e.g.:

 

on:
  push:
    branches:
      - '*'
- '*/*'

 

Copilot Lvl 2
Message 13 of 20

Re: How to run GitHub Actions Workflow only for new tags

@artalat Use two asterisks, that'll match sub-paths:

on:
  push:
    branches:
      - '**'

 

Pilot Lvl 1
Message 14 of 20

Re: How to run GitHub Actions Workflow only for new tags

The proposed solutuon doesnt seem to work for me.

:

on:
  push:
    tags:
    - '*'
Pilot Lvl 1
Message 15 of 20

Re: How to run GitHub Actions Workflow only for new tags

The proposed solution doesn't seem to work for me too :/ . 

Pilot Lvl 1
Message 16 of 20

Re: How to run GitHub Actions Workflow only for new tags

I am sorry. It is indeed working for me. Thank you 

Copilot Lvl 2
Message 17 of 20

Re: How to run GitHub Actions Workflow only for new tags

Hi @ethomson this solution appears to trigger when pushing to a new branch.

 

eg. `git push --set-upstream origin test` will cause it to trigger. Subsequent pushes will not cause it to trigger. Is this intended? 

 

UPDATE:

This problem appears to have be fixed on the GitHub side?

Copilot Lvl 2
Message 18 of 20

Re: How to run GitHub Actions Workflow only for new tags

where this needs to be updated.

 

I need to create trigger only when the tag is pushed/created in Github.any suggestion

Ground Controller Lvl 2
Message 19 of 20

Re: How to run GitHub Actions Workflow only for new tags

The assembly by the tag does not work, then ci starts when creating the branch

Copilot Lvl 3
Message 20 of 20

Re: How to run GitHub Actions Workflow only for new tags

Hi @ethomson 

 

What's the recomended way to run a step (or even a job) based on a Git tag?

 

The esiest way I found out is as follows:

steps:
- name: Check out from Git
uses: actions/checkout@v1

- name: Check if Git tag exists
run: echo "::set-env name=HEAD_TAG::$(git tag --points-at HEAD)"

- name: Runs only if Git tag exists
run: echo "This runs because Git tag points at HEAD ..."
if: env.HEAD_TAG != '' 

 

Would be handy if I could do like this:

steps:
- name: Check out from Git
uses: actions/checkout@v1

- name: Runs only if Git tag exists run: echo "This runs because Git tag points at HEAD ..." if: github.tag != '' 

 

Best Wishes,

- Oleg