Exclude specific event type

I want to exclude the prerelease event type for releases. How do I go about doing that?

@exorift,

You can limit your workflow runs to specific activity types using the types keyword.
In your case, you can configure the event in the workflow file like as this:

on:
  release:
    types: [prereleased]

With this configuration, the workflow will be triggered only when you set the release as a pre-release.
To view more details, you can see the β€œrelease event”.

I already have created under types, but that includes prereleases. I want to exclude prereleases from executing the action

@exorift,

I already have created under types, but that includes prereleases.

No, created does not includes prereleases. You may have some misunderstandings here.

When you click the β€œDraft a new release” button to create a new release and publish it as a pre-release, actually this operation includes two activity types of release event.

  • created - - A new release is created and saved. This activity will be triggered after you click the β€œDraft a new release” button and the β€œPublish release” button.

  • prereleases - - A release is set as a pre-release and saved. This activity will be triggered after you select the β€œThis is a pre-release” option and click the β€œPublish release” (or β€œUpdate release”) button.

When you click the β€œDraft a new release” button, then select the β€œThis is a pre-release” option, and click the β€œPublish release” button:

  • If you configure the event in the workflow file like as this:

    on:
      release:
        types: [created, prereleased]
    

    The workflow will be triggered twice by different activity types, one for created and another for prereleased.

  • If you configure the event in the workflow file like as this:

    on:
      release:
        types: [created]
    

    The workflow will be triggered only once by the activity type created.

More details, you can reference to this example.

2 Likes