Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

I've encountered some strange behavior with GitHub Actions workflows when using a default branch that is not main or master.
I tried searching the forums but couldn’t find any similar issues — maybe I didn’t search well enough. If you’ve run into something like this, please let me know.
Maybe I’m missing something, I don’t know...


Reproduce using the script

Note that sometimes it will show zero workflows — I’m not sure why that happens.
I guess GitHub needs more time than the 20-second sleep my script uses by default.

git clone git@github.com:Karuch/workflows-default-branch-bug.git
cd workflows-default-branch-bug.git
./reproduce.sh <github_username_or_org> [branch_name]

alt text

Describe the bug

In my repository, I have two workflows — workflowA.yml (triggered on push) and workflowB.yml (triggered on workflow_dispatch) — both located under .github/workflows/.

I created a blank repository (no README.md, LICENSE, etc.) Then I ran the following commands to initialize the repository with a first default branch named dev:

git init -b dev 
git remote add origin "git@github.com:org/repo.git"
git add .
git commit -m "Initial commit"
git push -u origin dev

I needed the initial default branch to be dev instead of main or master.
However, I noticed that even though both workflow files exist, the workflow with workflow_dispatch (workflowB.yml) only appears intermittently in the Actions tab.

I reproduced this using the gh CLI as well — creating the repository in the same way — and observed the same behavior. So it doesn’t seem to be just a UI issue.

To make it easier to reproduce, I created a repository containing a reproduce.sh script that:

  1. Creates a repository in the same way
  2. Lets you choose the initial branch name (so you can test with main/master and see that it always works there)
  3. Checks which workflows appear
  4. Deletes the created repository afterward

A way to make it appear again

If I create another branch and set it as the default (it doesn’t matter what I name it), GitHub seems to re-index the workflows, and then both workflows appear — even after switching the default branch back to dev.

I also created a script to reproduce this using the gh client:

./change_default_test.sh <github_username_or_org> [branch_name]

alt text

Expected behavior

All workflows in .github/workflows/ should appear in the Actions tab as soon as they exist in the default branch.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages