release-please-action icon indicating copy to clipboard operation
release-please-action copied to clipboard

Tag Created by release-please-action is not triggering build

Open samit-manna opened this issue 1 year ago • 3 comments

Build which is supposed to triggered by "tag creation" is not running when tag is created by release-please-action. Below is the trigger used in workflow. It triggers the flow when tag is created manually but doesn't run when tag is created by release-please-action

on: push: tags: - 'v[0-9]+.[0-9]+.[0-9]+'

samit-manna avatar Jul 20 '22 12:07 samit-manna

Where is the build defined?

tmatsuo avatar Jul 20 '22 17:07 tmatsuo

Where is the build defined?

Build is defined in same repo as Github Actions workflow. Below is the workflow (.github/workflows/tag.yml).

name: Tag-Build

on:
  push:
    tags:
      - 'v[0-9]+\.[0-9]+\.[0-9]+'

jobs:
  Tag-Build:
    runs-on: rocc-linux
    container:
      image: xxx
      credentials:
        username: ${{ env.DOCKER_USERNAME }}
        password: ${{ env.DOCKER_PASSWORD }}
      volumes:
        - /opt/github_actions_mapping/:/opt/github_actions_mapping/
    defaults:
      run:
        shell: bash
    steps:
      - name: Build
        run: |
          echo "tag build"

samit-manna avatar Jul 21 '22 05:07 samit-manna

We just started using this Action today and hit a similar issue. I believe its due to this caveat noted in the GitHub Action docs and the fact that this action sets token to be GITHUB_TOKEN by default.

When you use the repository's GITHUB_TOKEN to perform tasks, events triggered by the GITHUB_TOKEN will not create a new workflow run. This prevents you from accidentally creating recursive workflow runs. For example, if a workflow run pushes code using the repository's GITHUB_TOKEN, a new workflow will not run even when the repository contains a workflow configured to run when push events occur. For more information, see "Authenticating with the GITHUB_TOKEN."

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. To minimize your GitHub Actions usage costs, ensure that you don't create recursive or unintended workflow runs. For more information about creating a personal access token, see "Creating a personal access token." For more information about storing a personal access token as a secret, see "Creating and storing encrypted secrets."

Ps. you need to add the account you created the PAT token from to the repo (ie: give it access via Settings > General > Access)

sekhavati avatar Jul 21 '22 15:07 sekhavati