Workflows as a shared submodule

I have tried to make some shared workflows using git submodules.
But it doesn’t seem to recognize .github folder like that.

I’m aware of shared workflows feature, but it doesn’t work the way I expect it to work , it still needed to be added manually from actions page and it can’t get updated.

With submodule I can achieve those functionalities (with githooks or triggering github action to keep it updated)

Would be awesome if Github would support having .github submodules, would be useful for sharing through Github Organization.

This isn’t quite the same as your question since it doesn’t use a submodule directly in place of the .github folder. But I’ve used a submodule to share my workflows by putting it in a different directory such as build-tools and then using the “normal” .github/workflows/action.yml where the action.yml is just a passthrough to the submodule action(s) that you can then use between multiple projects. Hope this helps.

Here is an example passthrough:

name: build

on:
  workflow_dispatch:
    
jobs:
  build:
    runs-on: [self-hosted]
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Checkout submodules
        run: git submodule update --init --recursive

      - name: Build
        uses: ./build_tools/github_actions/workflows/build
1 Like