Workflow files only picked up from master?

For my first test of GitHub Actions, I created a branch gh-actions-test in a repository, copied the default template workflow file into the directory .github/workflows as test.yml, and pushed the branch to GitHub.

Now I would immediately expect to see this workflow in the “Actions” tab, but no such luck. OK, maybe it needs another push to be really kicked off? So I committed a dummy file to the repository, pushed this, and… still nothing in the “Actions” tab.

The only way I can make this workflow visible in the “Actions” tab is to merge my branch to master, and thus have one particular version of the files in the .github/workflows directory in master.

if true that workflow .yml files are only picked up from the most recent commit in master, then this would mean that any development on the workflow files themselves can only happen in master, and that CI steps can not evolve on other branches. Nor would I be able to add workflows on branches.

This seems like a very serious limitation, so I find it hard to believe. For example, with Azure Pipelines, the required azure-pipelines.yml file is picked up *on* each branch, *for* each respective branch.

So: How do I develop (and debug) my workflows outside of master?

10 Likes

A new workflow only appears in the “Actions” tab when it lands in the master default branch. Alternatively, you can access the new workflow via commit or PR.

Just tried

commit.png

1 Like

The actions displayed in the “Action” Tab will be the ones from your “default” branch. You can change the “default” branch in your repos settings.

:wave:we’re working on an update to the Actions tab so you’ll be able to see all of your workflows. Even ones that have not yet been merged into your default branch. I’m not exactly sure yet when we’ll ship it, but expect to see improvements within the next 2-3 weeks.

If you have any other ideas that would make this page better for you, let us know. :heart:

4 Likes

Thanks for the info.

It’s still unclear to me whether this just affects the first-time visibility in the ‘Actions’ tab, or whether, say, a workflow that started in the default branch, and later lives on only in another branch (but gets deleted from the default branch) would still be visible or not.

Not being able to work on (or create) workflows in non-default branches themselves is a major issue for me, and sort of defeats the whole purpose of GitHub Actions and an evolving CI, in my opinion.

Hoping this gets conceptually fixed, and looking forward to trying GitHub Actions again when that has happened.

4 Likes

Hey,

Any update on this one? this is a serious blocker for us

Regards

@liorhasson Can you share more about your workflow that this is blocking?

The latest state of the Actions tab is:

It shows all workflow runs (including those from workflows not in default branches).

The sidebar that allows you to filter by workflow name only shows workflow names that are currently merged into the default branch.

1 Like

I’m facing a similar issue. My default branch (master) does not contain any workflow. Adding a fairly simple workflow via Pull Request doesn’t get picked up and the status box remains empty also the Action tab. I copied this workflow from another repository so it’s supposed to work. I raised a support ticket (489403) which contains a link to the affected repository as well as the workflow file. 

It seems somehow affect only this repostiroy, because following the same steps in another repostiry works as exepcted. There was a syntax error in the inital commit of this Pull Request and I wonder if this can cause the issue. 

I found the problem. It’s related to the fact that for securiy reasons Actions run on the fork in case you modify the action. However, from a user perspective this is kind of confusing and not clear why this action doesn’t show up. 

https://github.community/t5/GitHub-Actions/GitHub-Action-workflow-is-executed-for-a-PR-from-a-forked-repo/td-p/29579

Is thre something I need to do to get workflow files from non default branch to show up in the Actions tab?

Per your message it should show work flows from non-default branches, but I’m not getting any showing up. 

1 Like

I’m having the same issues. Were you able to resolve this and get it working?

Hello, it’s more than a Year after you estimated this work to 2-3 weeks. Can we please get a more accurate estimation when it will be possible to test GitHub Actions before merging to master?

4 Likes

1 Add a new workflow file on the master, but specifying to run only on the desired banch.
2 Change to the branch you want with “git checkout specificbranch”.
3 run “git checkout master .github” -> “git add .” -> "git commit -m “merge actions” " -> “git push”

This will merge only in github actions folder and it will make everything work correctly, your new branch will now hear the changes (creating the github actions folder manually will not work)

Hi, are there any update on this topic?

This is a big problem for production repositories. In my case I cannot to push directly to master neither merge non tested PR.

1 Like

This is super upsetting right now. Even accessing the workflow from the commit, I can see that it is using the workflow from the master branch instead of the updated workflow.

I would have thought this would be a MVP requirement, considering every other CI tool out there allows branch-based CI instructions.

How is this not the top priority for gh actions?

Update 24/08/2020

Fixed for me.

According to the official GitHub Actions documentation (About workflow events):

The following steps occur to trigger a workflow run:

  1. An event occurs on your repository, and the resulting event webhook has an associated commit SHA and Git ref.

  2. The .github/workflows directory in your repository is searched for workflow files at the associated commit SHA or Git ref. The workflow files must be present in that commit SHA or Git ref to be considered.


    For example, if the event occurred on a particular repository branch, then the workflow files must be present in the repository on that branch.

  3. The workflow files for that commit SHA and Git ref are inspected, and a new workflow run is triggered for any workflows that have on: values that match the triggering event.


    The workflow runs on your repository’s code at the same commit SHA and Git ref that triggered the event. When a workflow runs, GitHub sets the GITHUB_SHA (commit SHA) and GITHUB_REF (Git ref) environment variables in the runner environment. For more information, see “Using environment variables.”

Because of this, in order to test the workflows we need to perform a git action (ie. do push) in the created branch for test its.

2 Likes

Maybe my last update post can help you: Workflow files only picked up from master?

Workflows files are picked up at the associated commit and Git ref (ie. refs/heads/master). So, if your commit is present in more than one branch, Git ref will define in which branch searching workflow files.

2 Likes

Was this a recent change? I was testing this when I made my previous comment, and it would use workflow files from master branch even though they were changed on the branch containing the triggering event.

1 Like

I really do not know. Right now it is working for me as defined by the documentation.