moonrepo / moon

A build system and monorepo management tool for the web ecosystem, written in Rust.
https://moonrepo.dev/moon
MIT License
2.82k stars 154 forks source link

[feature] requiredApprovals in globalPaths for supported vcs #1608

Open matray opened 1 month ago

matray commented 1 month ago

Is your feature request related to a problem? Please describe.

It would be nice to support requiredApprovals in codeowner global paths!

Describe the solution you'd like

Since this will require wrapping each file in a section (at least for gitlab), perhaps the following makes sense

$schema: 'https://moonrepo.dev/schemas/workspace.json'
projects:
  - 'apps/*'
  - 'packages/*'
vcs:
  defaultBranch: main
  provider: "gitlab"
codeowners:
  syncOnRun: true
  requiredApprovals: 1
  globalPaths:
   'example': ['@app-example']

which creates

[example][1]
example @app-example

However, it's not as configurable on a per-path basis. So either there would need to be a way to express that via a union type like so or a way to "append always" some sort of raw codeowner stanza (ugly)

$schema: 'https://moonrepo.dev/schemas/workspace.json'
projects:
  - 'apps/*'
  - 'packages/*'
vcs:
  defaultBranch: main
  provider: "gitlab"
codeowners:
  syncOnRun: true
  globalPaths:
   'example': 
      groups: ['@app-example']
      requiredApprovals: 1

Describe alternatives you've considered Adding a lifecycle hook somehow after moon runs (with codeowner sync on run turned on), or, disabling codeowner syncing entirely to self manage.

Additional context

milesj commented 1 week ago

Added to codeowners in 1.28. Need to figure out the per path still.

matray commented 1 week ago

You’re a beast! Will try it out with an upgrade to our tooling this week! Per-path was just a nice to have idea, no immediate need for it.