Replies: 3 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.
-
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
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