5

I have a Github workflow which is configured to trigger on tag push event:

on:
  push:
    tags:
      - "*"

The Github action triggers just fine in case I create a tag and push it myself from the command line or from Eclipse GUI with Egit/JGit plug-in.

If I do the same command-line tag creation from another Github action however, the Github action that should trigger on 'push tags' does not trigger.

Below the commands that I run inside the other Github action, or from Git-Bash, sucessfully in both cases :

git commit -a -m "prepare for new version $NEW_VERSION"
git push
git tag -a $NEW_VERSION -m "$NEW_VERSION"
git push origin $NEW_VERSION

Also tried the lightweight tag git tag $NEW_VERSION and various identities (including my own) through command-line git config --global user.name and git config --global user.email :

  • GitHub Action action@github.com
  • github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • github-actions github-actions@github.com

What am I missing here ?

Sybuser
  • 735
  • 10
  • 27
  • 2
    I would suggest to use the `on: create` trigger checking for the `ref/tag` context variable. You can find an example in this [thread comment](https://github.com/actions/runner/issues/1007#issuecomment-808904408). It could be a good workaround to test – GuiFalourd Mar 06 '22 at 14:56
  • just tried, it didn't work either, unfortunately. – Sybuser Mar 06 '22 at 15:32

1 Answers1

8

The answer is to use PAT - Personal Access Token for this action instead of GITHUB_TOKEN.

Here you can find more details:

https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow

If you do want to trigger a workflow from within a workflow run, you can use a personal access token instead of GITHUB_TOKEN to trigger events that require a token. You'll need to create a personal access token and store it as a secret

Grzegorz Krukowski
  • 18,081
  • 5
  • 50
  • 71