Feature request: allow workflow configuration in sub-folders · community · Discussion #18055

18 min read Original article ↗

I was searching for a way to organise many workflows in the UI, like by category or by team for a mono-repo. And I was thinking about just being able to create subfolders in the ./github/workflow/ folder, and that each folder would appear as a collapsable section in the UI.

But this proposal would be even better, at least when it comes to separation of files, but I'm not sure how it would be presented in the UI?

You must be logged in to vote

6 replies

@amitfmg

I like the suggestion about collapsible folders on the UI.

@chaddyc

@MunchyYDL, keen to see if Github will implement/develop this feature.

@garrmark

I'd like to add my support for the folders under .githuib/workflow that would be displayed as collapsable folders in the UI

@eliezercazares

This is enough for my needs. I have setup Automated Tests in the Workflows, using the Runners. And it's so many suites and tests that being able to organize my test suites would be cool. Because I also have workflows that do Slack notifications and are reused. So a common/ folder would be good for those.

@dselvi

This comment was marked as off-topic.

I was trying to do:

.github/
  - workflows/
    - dir_1
      - a.yml
      - b.yml
      - etc
    - dir_2
      - a.yml
      - b.yml
      - etc

With the hope that I would see a list of actions as

dir_1_a
dir_1_b
dir_1_c
dir_2_a
dir_2_b
dir_2_c

or something similar. Since the action names are configured in the yml files it would make sense to namespace actions according to the directory they are in. For my use case, aside from namespacing actions via a directory name, nothing would change (though since I use only a small subset of actions functionality I'm not sure if there are other considerations).

It would be nice if it was possible to put .github folders anywhere.

In any case, thank you for the actions tooling! It's pretty amazing.

You must be logged in to vote

1 reply

@krtschmr

seems quite tricky to scan all folders for a .github folder. subfolders in the .github would be sufficient i believe

It would also be rather nice if there could be a way to run a workflow nested in a submodule, and then leverage that same submoduled workflow to work on the parent repository. This is definitely a much bigger ask than what the original discussion was most likely tailored for, but it would certainly come in use for a repository I currently maintain.

You must be logged in to vote

0 replies

This will help a lot my team for a mono-repo! I hope to saw this feature soon

You must be logged in to vote

0 replies

You can do a lot of this by using a services/foo-service/action.yml and then put uses: ./services/foo-service/ into your .github/workflows/foo-service.yml.

It isn't perfect, but, you can do it.

Or, you could just use CODEOWNERS and have that map ownership of .github/workflows/foo-service-* to @foo-service.

Forcing GitHub to recurse through the entire tree, or even a large slice of a tree whenever it receives any event is almost certainly a non-starter. I appreciate the problem, but don't think that asking them to do this is likely to go anywhere.

What you can do is have your workflow load its configuration from a file at a path in your chosen directory. Many public workflows do this, although typically that directory is .github/actions/{action-short-name}/

You must be logged in to vote

7 replies

@tn3rb

Forcing GitHub to recurse through the entire tree, or even a large slice of a tree whenever it receives any event is almost certainly a non-starter.

what do you think is going to happen if you have a bunch of files like

.github/workflows/foo-service.yml
.github/workflows/bar-service.yml
.github/workflows/baz-service.yml

that all implement use to point to additional actions in subfolders like:

# in .github/workflows/foo-service.yml
uses: ./services/foo-service/ 

# in .github/workflows/bar-service.yml
uses: ./services/bar-service/ 

# in .github/workflows/baz-service.yml
uses: ./services/baz-service/ 

GitHub is going to load all of those actions in the root of .github/workflows and THEN have to ALSO go into those subfolders anyways.

Sound like even more work than just recursing through a folder structure like:

.github
    - workflows
        - foo
            - service.yml
        - bar
            - service.yml
        - baz
            - service.yml

which is not an unreasonable request in this day and age

@jsoref

That isn't how the GitHub Action Runtime works.

When it gets an event, it only needs to enumerate objects in a single folder (on at most two branches -- default and the current one).

For each object, it then decides if the workflow is enabled, and then if the workflow applies.

If it's enabled and it applies, then it dispatches it to a mechanism that will send things to runners which will then digest the uses lines. It's done much later in the pipeline, and it isn't done by enumerating all objects in the repository, it looks for very specific paths ./services/baz-service/ {action.yaml | action.yml }

@jeffrey-aguilera

find .github/ -type file -name *.yml is incredibly fast. There is really no excuse for preventing users from organizing their workflows.

@sparr

@jeffrey-aguilera Not only do some repos contain yaml files that aren't github workflows, some repos contain valid github workflows as the content of the repo, not as workflows to be run on that repo.

@Anonymous-Coward

You can do a lot of this by using a services/foo-service/action.yml and then put uses: ./services/foo-service/ into your .github/workflows/foo-service.yml.

My biggest gripe with this is that it doesn't give you any possibility to organize workflows in the UI. I have several dozen workflows, over a hundred, which do exclusively the uses thing with a handful of reusable workflows. It's time-consuming, with the current actions UI, to find the one I'm looking for. Without some structure inside /github/workflows, or an artifficially created one by specifying something like `path: ["sub-dir-1", "sub-dir-2", "sub-dir-3"] for the workflows to be shown in a tree structure, I can't see how reusable actions/workflows can help with this problem.

A good workaround is symbolic links in your root directory .github/workflows folder

You must be logged in to vote

7 replies

@raihle

I'm not sure that works at all, but I know it doesn't work when adding, removing, or renaming workflow files

@socketbox

@sam0x17

yes it does not work unfortunately. Wish it did

@danielfigueiredo

I've tried using symbolic links and GHA will raise errors when trying to parse workflow files

@Anonymous-Coward

A good workaround is symbolic links in your root directory .github/workflows folder

Not really. Even if it would work, the workflow links inside .github/workflows would still be presented as soup. You can't easily work with that soup when you have well over a hundred workflows in the same repo.

This feature would be awesome to have for when using both re-usable workflows and the "regular" workflow. Right now, I'm naming things with emojis in front of them to do this. 😂 It gets a little ⚡ if it's a re-usable.

You must be logged in to vote

6 replies

@zomgbre

All I did was paste in the emoji in vscode in front of the name :P it was a little silly:

name: '⚡ ci'
on:
  workflow_call:
    inputs:
      node-version:
        description: Node version
        type: string
        required: true
      working-directory:
        description: Working directory to use
        type: string
        default: './'

jobs:
  test:
    name: Test
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ${{ inputs.working-directory }}
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      - name: Use nodejs ${{ inputs.node-version }}
        uses: actions/setup-node@v3
        with:
          node-version: ${{ inputs.node-version }}
          registry-url: 'https://npm.pkg.github.com'

      - name: Install with package-lock
        run: npm ci
        env:
          NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}

      - name: Compile typescript
        run: npm run build
      - name: Tests
        run: npm run test

I have since abstracted these workflows into a separate repository and now referencing them like so across several similar projects:

name: ci
on:
  pull_request:
    branches:
      - main
      - release/**

permissions:
  contents: read

jobs:
  ci:
    uses: orgname/repo-name/.github/workflows/ci.yml@main
    secrets: inherit
    with:
      node-version: 18

@granthorner

thanks @zomgbre I guessing there's no way to actually display the emoji directly within the github actions list in a way to help group them?
Screenshot 2023-08-24 at 09 10 01

@jsoref

@zomgbre

You can copy the emojis from here: ❤️
https://gist.github.com/rxaviers/7360908

It's gotta be the actual emoji and not the markdown :heart: Hehe, it seems counter-intuitive a bit because you'd think it would render with the colons.

@granthorner

Ah that's amazing, that's where I was going wrong....much appreciated for your help @zomgbre

You must be logged in to vote

1 reply

@ErikBjare

You mean the symlink suggestion?

Instead of recursing through the whole repo, why not provide a keyword in the root .github/workflows that can be used to point to the "sub-root" of the directory you want to treat as it's own repo (for actions)?

Something like this:

In /.github/workflows/package_1.yaml:

In /package_1/.github/workflows/package_1.yaml:

# regular github actions config, as if this were the root package

Benefits:

  • Almost complete code separability. (Only needs to add that one line / file to the root)
  • No need to recurse anything.
You must be logged in to vote

1 reply

@rawnly

Couldn't this can be archived via the uses keyword as mentioned before?

Copying this feature request over from https://github.community/t/feature-request-allow-workflow-configuration-in-sub-folders/16776

We use a monorepo setup and currently everything is organized into sub-folders, so for example all services are located in the “services” folder. Currently workflow configuration is the only code which relates to a service that is not in the applicable “services” folder (e.g. “services/foo-service”). In order to maintain clean code separation and ownership, it would be nice if we could place our workflow configuration for a specific service in it’s appropriate folder. The most straightforward solution would seem to be matching on any .github folder in the repo, not just the root one. This would allow us to place workflows in the “services/foo-service/.github/workflows” folder, for example.

You must be logged in to vote

0 replies

This would be a nice feature for our template projects, to make certain workflows optional and easy to tear out (with related scripts). eg. "Not using the event queue system? tear out the workflow and related integration testing scripts by pulling ONE folder..."

Suggested workaround: strictly enforced naming conventions on the workflow files. e.g. "event_queue.integration_test.stage.yml" mirroring a folder src/event_queue or something (I don't like my example a ton, but it illustrates the point)

You must be logged in to vote

0 replies

also running a monorepo and having workflow subfolders would be great as we have a lot of granular separation going on.

this would be ideal for us:

.github
    - workflows
        - foo
            - deploy.yml
            - e2e-test.yml
            - unit-test.yml
        - bar
            - deploy.yml
            - e2e-test.yml
            - unit-test.yml
        - baz
            - deploy.yml
            - e2e-test.yml
            - unit-test.yml
You must be logged in to vote

0 replies

I've been following this thread for a while, if you're interest I made a simple cli in rust that can help with workflows context separation. Is still a WIP, nothing fancy. Hope this helps someone ✌️

https://github.com/rawnly/hawk

You must be logged in to vote

2 replies

@rodrigo-georgian

@rawnly

If anyone willing to use it, I just updated and released hawk, now is "generally available" ✌️

Has there been any progress made on this? Being able to define a .github directory within subfolders would be ideal, however what @tn3rb suggested would also be great.

You must be logged in to vote

0 replies

We are using monorepo setup and our .github/worflows is getting out of control. Before Actions, we were using Buildkite and it allowed to add workflows in specific folders for services as suggested by the OP. The root workflow is getting too big and unmanageable and we are considering moving back to Buildkite just for this reason :(

You must be logged in to vote

0 replies

It’s June 2025 and we’re still organizing dozens of files by naming convention like we’re living in a man cave with no shelves. Just vibes and chaos.

You must be logged in to vote

0 replies

You must be logged in to vote

4 replies

@AleksaRistic216

At this point I am convinced they keep this as their morning fun. While sipping hot nice coffee, they scroll and laugh at new people having encountering this problem.

They are like "Huh, you thought it was obvious, but we got you!", sip, sip, sip... hahaha, sip...

@nebuk89

@MrAtkinson sadly nothing right now, we have search still as something we are trying to do as a 'paper cut' small fix in this direction. But other than that :( we haven't been able to get to this yet.

Thank you for the positive engagement and I do read the requests coming into this and all these tickets, there are sips but it's mainly 😭 at the rate we are solving them not laughter. (maybe manic laughter eventually if we get near shipping).

Thank you all for the positive engagement still, one day we will get out of the man in a cave with no shelves ❤️

@silkfire

If MS would stop laying off so many of their developers (and replacing them with AI) maybe this would have been shipped by now 🤷🏻‍♂️

@NorseGaud

@silkfire I could vibe code the feature for this with AI in 20 minutes. That's not the issue lol

In Azure DevOps Pipelines this feature has been available for years. Since Github is Microsoft, why it is not implemented yet?

You must be logged in to vote

0 replies

You must be logged in to vote

0 replies

my first mono repo and it's sadly a Github mess :(

You must be logged in to vote

0 replies

First time working mono repo. I was happy, organized all my workflows in folders... Took me years to rename everything. All for nothing :,(|
image

You must be logged in to vote

2 replies

@AlexanderWangY

I also just did this in a monorepo... could not overstate my disappointment.

@AleksaRistic216

That means you will experience happiness 2 times. First is when you were organizing your workflow files. Second will be in abt 7 years when they finally implement this.

this is such poor design, let us use file directories!

You must be logged in to vote

0 replies

I do find it surprising that after so many years such a basic feature has not been implemented yet. - At absolute minimum they could just manipulate it so that _ could represent a subfolder in the UI or similar.

You must be logged in to vote

2 replies

@AleksaRistic216

Well, that actually is nice suggestion as small plugin.

@AleksaRistic216

image image

Well, I did create fast extension for it. and it does work nicely. Whole logic is to name files with underscore as you mentioned.
I have created it for VS Code only at the moment, however will update for JetBrains IDEs and Visual Studio.
I did publish it as extension for easier installation using ext install LimitlessSoft.github-workflows-explorer
Source code can be found here

image

Here are two potential implementations:

Using Labels or Tags:

Allow a new key in the workflow .yml file (e.g., labels or category) to define a category. The GitHub Actions UI could then display these as collapsible sections.

Directory-Based Grouping:

Alternatively, the UI could automatically use the directory structure within the .github/workflows/ folder to create groups. For example, a workflow at .github/workflows/infra/my-infra-provision.yml would appear under an "Infra" group in the UI.

.github/
└── workflows/
    ├── apps/
    │   ├── frontend-deploy.yml
    │   └── backend-deploy.yml
    └── infra/
        └── my-infra-provision.yml

This feature would greatly improve the user experience for monorepos, making the Actions tab cleaner and more intuitive. It would reduce the cognitive load for developers, allowing them to quickly find and monitor the workflows they care about.

You must be logged in to vote

0 replies

Does github team actually read any of these? 😓 I see several community boards that are years old. Its kind of crazy i cant categorize my workflows into sub folders.

You must be logged in to vote

5 replies

@AleksaRistic216

They are reading. You can see response from GH actions PM a little bit above (here)

@nebuk89

We do :)

Sorry this one hasn't come up yet. I appreciate that it's the second most asked for thing by the community (after parallel steps). We are still looking at burning down 'quicker bits' than this , but come the new calendar year (hopefully 🤞 ) we will start working out what we may do here.

Sorry again that this is still sitting.

@joshwillcock

burn

What bits could be quicker than this? Short of changing a font weight this appears to be a very small feature.

@MrAtkinson

We do :)

Sorry this one hasn't come up yet. I appreciate that it's the second most asked for thing by the community (after parallel steps). We are still looking at burning down 'quicker bits' than this , but come the new calendar year (hopefully 🤞 ) we will start working out what we may do here.

Sorry again that this is still sitting.

Would the team consider putting those quicker bits aside to prioritize the second most asked for thing by the community if I said please?

@NorseGaud

I'll do one better: I'll buy the entire team beers next time I'm in Microsoft land.

I'd love this to be possible, we use a workflows repository to allow us to share workflows and scripts however its quickly becoming quite a mess.

Current solution is to prefix them all with their purpose "codebase", "terraform", etc but its not the slickest looking thing and can take my eyes a few seconds to adjust when staring at a list of mostly identical names because its being used to group similar things together.

You must be logged in to vote

1 reply

@AleksaRistic216

I did create VS Code extension which allows to hame nested view, following some conventions (which if created using UI, extension do for you)

#18055 (reply in thread)

Other option I found out is creating separate repository (my-actions) and there nest folders however you want, with "action.yml" inside folder. Then from main repo, call action "/my-actions/some-directory/some-other"

+1. Would be a huge improvement for monorepo devops

You must be logged in to vote

0 replies

This is a good example of a missing feature that makes it less savory for enterprise customers to move to GitHub. I really hope they begin to start taking their QoL more seriously. Crossing my fingers they're able to prioritize a highly requested feature (what a huge win that would be for everyone).

You must be logged in to vote

1 reply

@lvanatta-fnba

Some of our workflows are very complex and we want a way to organize them, apply permissions, etc. It would be extremely helpful for our growing organization to have a system that can leverage something as simple as subdirectories to organize the mountain of app deployment workflows we have to sift through to find the infra deployment workflows.

I also use mono repo and there are now dozens of workflows catering for different applications, cloud platforms and devops lifecycles (build, release, deployment). A subfolder structure will definitely make it easier to organise. At the moment, I just use naming conventions.
I tried to use workspaces in vscode and put github workflows into each sub workspaces. However, I find myself difficult to adapt the workspace concept for one repo hence eventually gave up.

You must be logged in to vote

2 replies

@AleksaRistic216

Another way I am using at the moment and playing around with is to create separate repository like this-project-github-actions and there you can create subfolders like ~/do-this within which you will have action.yml (name of file must be like this).
After that, from original repo you can call this exact workflow like uses: YourUserOrOrganization/this-project-github-actions/do-this.
You can't have multiple different actions within same directory (at least I haven't tried finding way how to do it), but at least you can nest them so maybe it can fit your case.

@tang2087

Another way I am using at the moment and playing around with is to create separate repository like this-project-github-actions and there you can create subfolders like ~/do-this within which you will have action.yml (name of file must be like this). After that, from original repo you can call this exact workflow like uses: YourUserOrOrganization/this-project-github-actions/do-this. You can't have multiple different actions within same directory (at least I haven't tried finding way how to do it), but at least you can nest them so maybe it can fit your case.

yes that could be a good way too, I will definitely consider it. thanks.

Between proper serial workflow execution queueing, lack of monorepo support (this issue), and the service availability issues this year, I cannot in good conscience recommend GHA as a modern automation platform anymore. For any of the product owners who may read this and need help getting buy-in, feel free to let your stakeholders know you are losing paying users to Gitlab/Circle over this.

You must be logged in to vote

0 replies