Replies: 2 comments
-
Upvote, I have similar scenario, but could not find any solution so far.
name: Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
name: Deploy
on:
workflow_run:
workflows: [ 'Test' ]
types: [ completed ]
branches: [ main ] Deploy action is now ran when I open a pull request for merging into |
Beta Was this translation helpful? Give feedback.
-
I suggest to read the workflow_run webhook documentation (I only looked this up, not tested) if: github.event.event != 'push' Sources: https://docs.github.com/en/webhooks/webhook-events-and-payloads#workflow_run and https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#github-context github.event_name is always Even with a if you get entries for workflow runs, but no Action Minutes. |
Beta Was this translation helpful? Give feedback.
-
Select Topic Area
Question
Body
Hi. I have a
on: workflow_run
Action that runs upon completion of one of more other Actions and posts a comment in a pull request. It only makes sense for theworkflow_run
Action to run when the dependent Actions were run due to a pull request (even though the latter could also run on a push). I am looking for a way to restrict that action so it does not run on a push.The yml looks as follows:
I thought the line
if: github.event_name != 'push'
would do it, but the workflow runs anyways (and fails because... it's not a pull request). I tried moving theif
just after theuses:
, but that fails in the same way.What is the correct way to corral such a workflow?
Thank you in advance!
Beta Was this translation helpful? Give feedback.
All reactions