feat: discover workflows in subdirectories of .mokogitea/workflows/ #693

Closed
opened 2026-06-23 18:05:27 +00:00 by jmiller · 1 comment
Owner

Summary

Gitea Actions currently only discovers workflow YAML files at the root level of .gitea/workflows/ (or .mokogitea/workflows/). Files in subdirectories like .mokogitea/workflows/custom/ are NOT auto-discovered.

Proposed Behavior

Recursively discover *.yml / *.yaml files in subdirectories of the workflows directory. This allows organizations to use folder-based organization:

.mokogitea/workflows/
  ci-generic.yml           # synced from template
  pr-check.yml             # synced from template
  custom/
    deploy-staging.yml     # repo-specific, preserved during sync
    nightly-tests.yml      # repo-specific

Use Case

MokoCli's workflow_sync command pushes template workflows to all repos. Repos need a way to have custom workflows that aren't deleted during sync. Subfolder discovery would let repos put custom workflows in custom/ and have them auto-discovered by Gitea Actions while being protected from sync cleanup.

Current Workaround

Use a custom- filename prefix at the root level. Works but is less clean than folder-based separation.

## Summary Gitea Actions currently only discovers workflow YAML files at the root level of `.gitea/workflows/` (or `.mokogitea/workflows/`). Files in subdirectories like `.mokogitea/workflows/custom/` are NOT auto-discovered. ## Proposed Behavior Recursively discover `*.yml` / `*.yaml` files in subdirectories of the workflows directory. This allows organizations to use folder-based organization: ``` .mokogitea/workflows/ ci-generic.yml # synced from template pr-check.yml # synced from template custom/ deploy-staging.yml # repo-specific, preserved during sync nightly-tests.yml # repo-specific ``` ## Use Case MokoCli's `workflow_sync` command pushes template workflows to all repos. Repos need a way to have custom workflows that aren't deleted during sync. Subfolder discovery would let repos put custom workflows in `custom/` and have them auto-discovered by Gitea Actions while being protected from sync cleanup. ## Current Workaround Use a `custom-` filename prefix at the root level. Works but is less clean than folder-based separation.
Author
Owner

Resolved in afe46361c7.

The recursive discovery infrastructure already existed — ListWorkflows uses ListEntriesRecursiveFast() (git ls-tree -t -r), and IsWorkflow() uses a prefix check that naturally handles subdirectory paths. Added test cases confirming both single-level and deeply nested subdirectory workflows are discovered.

Moved 6 custom (non-synced) workflows to .mokogitea/workflows/custom/:

  • deploy-mokogitea.yml, deploy-dev.yml, cascade-dev.yml, pr-rc-release.yml, test-mokogitea.yml, upstream-bug-sync.yml

These are now cleanly separated from the 16 template-synced workflows (which have FILE INFORMATION headers and stay at root level).

Resolved in afe46361c7. The recursive discovery infrastructure already existed — `ListWorkflows` uses `ListEntriesRecursiveFast()` (`git ls-tree -t -r`), and `IsWorkflow()` uses a prefix check that naturally handles subdirectory paths. Added test cases confirming both single-level and deeply nested subdirectory workflows are discovered. Moved 6 custom (non-synced) workflows to `.mokogitea/workflows/custom/`: - `deploy-mokogitea.yml`, `deploy-dev.yml`, `cascade-dev.yml`, `pr-rc-release.yml`, `test-mokogitea.yml`, `upstream-bug-sync.yml` These are now cleanly separated from the 16 template-synced workflows (which have `FILE INFORMATION` headers and stay at root level).
Sign in to join this conversation.