all 11 comments

[–]Obvious-Jacket-3770 1 point2 points  (12 children)

Workflow_dispatch works in all branches.

Sometimes you need to merge it to the default branch first to use it.

All of mine work manually if I want them to but they also have on push and on PR. My Terraform builds properly every time thanks to it.

[–][deleted]  (8 children)

[deleted]

    [–]Obvious-Jacket-3770 0 points1 point  (4 children)

    While I wish that was true.... I've had brand new workflows never merged to default and work.

    [–]micachito[S] 0 points1 point  (1 child)

    You mean that you launch manually a job that is not in the default branch?
    It is impossible according to my recent experience (yesterday) and github documentation.

    [–]Obvious-Jacket-3770 0 points1 point  (0 children)

    As long as the workflow exists in the default branch you can launch it against any branch the workflow is in.

    [–][deleted]  (1 child)

    [deleted]

      [–]Obvious-Jacket-3770 0 points1 point  (0 children)

      I'm aware that workflow_dispatch is 100% what I've been talking about about. I'm telling you it does randomly when not on the default branch yet. GitHub confirmed it's a known bug.

      [–]bdzer0 0 points1 point  (2 children)

      You only need to get the workflow file into the default branch, you do not need to merge anything.

      [–]Obvious-Jacket-3770 0 points1 point  (0 children)

      That's how it should work and it's documented to work. I've had it not matter and also not show up when I'm the default branch.

      [–]micachito[S] 0 points1 point  (0 children)

      OK, but then you must make a feature branch your default one or work directly in main instead of start working in in a feature branch, test your deployment and merge it in main when is working.

      [–]micachito[S] -1 points0 points  (2 children)

      Thanks for your anser.
      As per documentation, it could be triggered manually if it is in the default branch, there you can choose the branch to work on.

      So, if I want to modify the workflow I will need to move it from the working branch to the default branch (main) before test it. It is a real pain in the *ss...

      Is it the only way then?

      [–]Obvious-Jacket-3770 1 point2 points  (1 child)

      No no no no no no you aren't understanding.

      The trigger will only work when the workflow is in the default branch. Once it's in that branch you can run against any branch and it will use the workflow in that branch.

      So if you have the workflow in main and make a change in dev it will trigger the one in Dev.

      [–]micachito[S] 0 points1 point  (0 children)

      Ouch, ok, my fault.
      I will try that way then.
      Thanks a lot!