New tag does not trigger an event

I would like to trigger a new action after creating a new tag in a PR close & merge action:

So, step 1: PR close & merge that creates a tag and pushes it to master successfully:

    branches: [ master ]
    types: [closed]

    runs-on: ubuntu-latest
    - uses: actions/checkout@v2  
        fetch-depth: 0

    - name: Git Tag
      if: github.event.pull_request.merged == true
      run: |
        git tag ${VERSION} ${GITHUB_SHA}
        git push --tags origin master

Step 2 (version a): When a new tag is pushed, initiate an event

    - '*'

Step 2 (version b): When a new tag is created, initiate an event


Even though I have tried both approaches an event is not triggered. Please help.

Note: When I do manually git tag and git push --tags (not using GitHub Actions), an event (mentioned in Step 2) is triggered.

Hi @ivanovaleksandar,

Glad to see you in Github Community Forum!

This is due to events triggered by the GITHUB_TOKEN will not create a new workflow run. It’s mentioned in the official doc here.

‘actions/checkout’ will persist GITHUB_TOKEN for latter git operations, hence the tag is pushed with GITHUB_TOKEN. You can add “persist-crendetials: false” to avoid this.

    - uses: actions/checkout@v2  
        fetch-depth: 0
        persist-credentials: false

You can create a secret wih Personal Access Token and use it to push a tag.

I tried to use rest api to create a tag, code sample as below, it use PAT and can trigger workflow.

     - name: push git tag
       run: |
         curl -s -X POST${{ github.repository }}/git/refs \
           -H "Authorization: token ${{ secrets.PAT1 }}" \
           -d '{ "ref": "refs/tags/v3.0.4", "sha": "shavalue" }'


@weide-zhou thanks for the reply, but whenever I try to do this with the rest api call that you suggested, I am faced with this (even though I used a PAT from an admin user with all scopes enabled):

  "message": "Not Found",
  "documentation_url": ""

What am I missing here?

Hi @ivanovaleksandar,

Thanks for your reply! What’s your code? Is there any typo?

My workflow for your reference:
push tag:
2nd workflow triggered:

It’s just a sample code which use PAT token, you can change it with your case.


Thank you @weide-zhou !

There were permissions missing for the call.