Workflow triggered for both published and prereleased #26301
-
I have two workflows in my app, and I want one to trigger on pre-release publish, and the other to trigger only when the published relase is not a pre-release. How can I configure this? Now I filter one on published, and the other on prereleased, but both of them ends up beeing triggered each time. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @robert-larsen , Many thanks for your feedback! According to the official doc, if a prelease is created, it has a parameter ‘preleased’ and value is true. However for parameter ‘draft’, it’s ‘false’ by default, which will trigger publish event. That’s why both workflows are triggered. Hence only when you create a prelease release with draft mode, published event will be not triggered. Currently it’s not supported to only trigger prelease event but exclude publish event. |
Beta Was this translation helpful? Give feedback.
-
Note that the terms are “prerelease” and “prereleased”, not “prelease” and “preleased”. I’m not sure I understand what you’re saying with respect to draft mode. The original poster did not use the word “draft”, so I’m not sure how it’s related to their question. From the document that you link to, “draft” seems to be a parameter at the same level as “prerelease”. Are you saying that when “draft” is set to “true”, the value of “prerelease” (whether “true” or “false”) is ignored? Or are you saying it affects the value of “types” (“published”, “edited”, “released”)? In any case, in the GitHub GUI, when the checkbox next to “This is a pre-release” is checked, and “Publish release” (rather than “Save draft”) is pressed, I assume that the parameter “draft” is not set. Is that correct? And in any case, “draft” shouldn’t affect whether the condition “github.event.release.prerelease” is set, so this condition should safely determine whether it’s a prerelease:
Is that correct? |
Beta Was this translation helpful? Give feedback.
Hi @robert-larsen ,
Many thanks for your feedback!
According to the official doc, if a prelease is created, it has a parameter ‘preleased’ and value is true. However for parameter ‘draft’, it’s ‘false’ by default, which will trigger publish event. That’s why both workflows are triggered.
Hence only when you create a prelease release with draft mode, published event will be not triggered.
Currently it’s not supported to only trigger prelease event but exclude publish event.