-
You can trigger off of a pull request event in your workflow file: https://docs.github.com/en/actions/reference/events-that-trigger-workflows#pull_request |
Beta Was this translation helpful? Give feedback.
-
Thanks for looking! But I should have worded it differently. I’m looking to have the workflow peer-reviewed before integrating it into the main branch. This means that the workflow is not yet available or merged with the main branch. Because it is not yet available, displayed, showing in the Github actions, I won’t be able to trigger it: manually, by PR, etc. I believe that Github does not yet support running workflows that only exist in a none main branch. Am I correct? Example use-case:
|
Beta Was this translation helpful? Give feedback.
-
heldrida:
It depends on the event type. There are certain event types for which the workflow file must be on the default branch (e.g. Check |
Beta Was this translation helpful? Give feedback.
-
Thanks for the support! If the PR holding a new workflow hasn’t yet been approved and merged to the “main” branch, is it expected to show in the actions? Here’s an example, which is not showing (the workflow yaml only exists in the pending PR):
My expectation was that at least I could trigger it manually, as you see the |
Beta Was this translation helpful? Give feedback.
-
My apologies, just found that I have the paths, in which the changes at the moment do not full-fill as I’m only working in workflow. By removing it, the action does show as expected! |
Beta Was this translation helpful? Give feedback.
-
for workflow_dispatch, you HAVE to have a version of the file in the main branch. |
Beta Was this translation helpful? Give feedback.
-
But workflow_dispatch will only run the workflow version that’s checked into the main branch, right? |
Beta Was this translation helpful? Give feedback.
-
Ahhh, see that is where things get interesting. To initially make it show up on the Actions tab, and so that you can trigger it manually, it has to be checked in to the main branch. BUT, when you trigger it, you can pick which branch to run it against. The only caveat is that the workflow file (or a version of it) also has to exist IN THAT BRANCH. |
Beta Was this translation helpful? Give feedback.
-
ok, got it. thanks. but for |
Beta Was this translation helpful? Give feedback.
-
That I don’t know I’d have to test it and see. The docs don’t say. Logically it makes sense that yes it would have to be on the main branch for repository_dispatch to work |
Beta Was this translation helpful? Give feedback.
-
As far as I can tell with my limited experience with |
Beta Was this translation helpful? Give feedback.
-
This is what I’d love:
|
Beta Was this translation helpful? Give feedback.
-
I was struggling with this too. I followed what I picked up from this thread and did the following:
|
Beta Was this translation helpful? Give feedback.
-
Fwiw, as long as the repository is public, you can create a public fork and set your public fork’s default branch to the version which has the code you want to demonstrate. (And possibly w/ the same name as the expected destination branch, instead of the name of the feature branch in your fork as used for your PR.) In your case, removing the In some cases you could just add a second branch, as in:
|
Beta Was this translation helpful? Give feedback.
-
Hi,
I’d like to test a workflow in a PR, but from what I understand it only shows and runs if committed to the “main branch”.
Is there a way to have new workflows show and run in the PR stage?
Just to be clear, a new workflow in
.github/workflows/some-workflow.yml
, when committed in a new PR, it won’t show up in the actions and I’d like to have it and run it before committing to the main branch.Thank you!
Beta Was this translation helpful? Give feedback.
My apologies, just found that I have the paths, in which the changes at the moment do not full-fill as I’m only working in workflow.
By removing it, the action does show as expected!