Skip to content
This repository has been archived by the owner on Mar 4, 2021. It is now read-only.

Clarification on triggering events after release #71

Open
smac89 opened this issue May 20, 2020 · 4 comments · May be fixed by #115
Open

Clarification on triggering events after release #71

smac89 opened this issue May 20, 2020 · 4 comments · May be fixed by #115

Comments

@smac89
Copy link

smac89 commented May 20, 2020

The readme has the following line:

This will create a Release, as well as a release event, which could be handled by a third party service, or by GitHub Actions for additional uses, for example the @actions/upload-release-asset GitHub Action.

I think there should be some clarification that a release event created with the default github.token (or secrets.GITHUB_TOKEN), will not trigger another workflow. The user will have to use a personal access token for this to work.

@murlakatamenka
Copy link

murlakatamenka commented Sep 1, 2020

@smac89 do I get it right that release event won't trigger at all?

After using create-release on the previous step ${{ github.event.release.tag_name }} is empty when using on the following one.

name: Test event.release.tag_name

on:
  push:
    tags:
      - "[0-9]+.[0-9]+"

jobs:
  release:
    name: Create Release
    runs-on: ubuntu-latest
    steps:
      - name: Checkout code
        uses: actions/checkout@v2

      - name: Create Release
        id: create_release
        uses: actions/create-release@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          tag_name: ${{ github.ref }}
          release_name: ${{ github.ref }}

      - name: check tag
        if: ${{ github.event.release.tag_name }} == ''
        run: |
          echo Epic fail
          exit 1

@smac89
Copy link
Author

smac89 commented Sep 4, 2020

@smac89 do I get it right that release event won't trigger at all?

@murlakatamenka I'm not too sure I understand your question. Events trigger workflows, but actions can also do things that create events, which end up triggering workflows. For example, using this create-release action will run the action, which will create a release, and trigger the release event.

My point in posting that issue comment is to point out that after this action runs, the release event it creates will not trigger another workflow, if you used the default GITHUB_TOKEN secret for authentication (which you are using). You can see the link I referenced to read it for yourself.

Moreover, in your current setup, this workflow will not be able to get the payload from the release event. Why?

For two reasons:

  1. *Since the event was triggered inside this workflow, it is not possible that you will see it within the same workflow that triggered the event.
  2. Your workflow is not setup to be triggered when a release event occurs, i.e. your on section does not include release, only push.

*Actually I'm not too sure about the first reason, but I doubt workflows are able to see new events which occur after the workflow started. Don't quote me on that one, but you can test and see if it works.

@murlakatamenka
Copy link

murlakatamenka commented Sep 5, 2020

I see, I understand it better now:

My point in posting that issue comment is to point out that after this action runs, the release event it creates will not trigger another workflow, if you used the default GITHUB_TOKEN secret for authentication (which you are using).

Thank you very much! @smac89

@madhead
Copy link

madhead commented Jan 5, 2021

Damn, I've spend a day trying to figure out why this (from another workflow)

on:
  release:
    types:
      - published
      - created

is not triggered by releases created with this action, but successfully triggered by "manual" releases!

The docs definitely must note this…

smac89 added a commit to smac89/create-release that referenced this issue Jan 7, 2021
Closes actions#71

The purpose of this PR is to make an important note about user expectations with regards to the `release` event created by this action. The crux of it is that the release event created by this action will not trigger another workflow.
@smac89 smac89 linked a pull request Jan 7, 2021 that will close this issue
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants