githubgithub-actions

How to test github workflow without merging into master/main branch


I am creating a new git workflow. And just like any other piece of code, I want to test it separately without having to merge it into master first.

This will also help if I have to make few corrections if something doesn't work in the workflow yaml.

Here is the mechanism that I am looking for:

  1. main branch has .github folder which contains all workflows
  2. I create a branch and add my workflow to .github folder
  3. Now I should be able to see(somewhere on Github) workflows running from my branch, including the new workflow
  4. Once I know that the new workflow is working fine, I merge my branch in master
  5. Now under github 'Action' tab, new workflow will reflect

Is there a way to do this?


Solution

  • I am actually doing workflow testing all the name, as you can see this test workflow workflow-level-notification is not merged into master branch (ie default branch), and I can still see the workflows in the UI.

    Like GuiFalourd said, you can also use act to do the local testing as well. But working directly in the github repo is not that bad. (you can delete the workflow after)