add mechanisms for finding and pinging maintainers
This commit is contained in:
parent
ef5c6ea096
commit
c4a891d425
5 changed files with 97 additions and 0 deletions
|
@ -60,10 +60,12 @@ subcommands = [
|
|||
'qmk.cli.lint',
|
||||
'qmk.cli.list.keyboards',
|
||||
'qmk.cli.list.keymaps',
|
||||
'qmk.cli.list.maintainers',
|
||||
'qmk.cli.kle2json',
|
||||
'qmk.cli.multibuild',
|
||||
'qmk.cli.new.keyboard',
|
||||
'qmk.cli.new.keymap',
|
||||
'qmk.cli.ping.maintainers',
|
||||
'qmk.cli.pyformat',
|
||||
'qmk.cli.pytest',
|
||||
]
|
||||
|
|
16
lib/python/qmk/cli/list/maintainers.py
Normal file
16
lib/python/qmk/cli/list/maintainers.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
"""List the keymaps for a specific keyboard
|
||||
"""
|
||||
from pathlib import Path
|
||||
|
||||
from milc import cli
|
||||
|
||||
from qmk.maintainers import maintainers
|
||||
|
||||
|
||||
@cli.argument("files", type=Path, arg_only=True, nargs='*', help="File to check")
|
||||
@cli.subcommand("List the maintainers for a file.")
|
||||
def list_maintainers(cli):
|
||||
"""List the maintainers for a file.
|
||||
"""
|
||||
for file in cli.args.files:
|
||||
cli.echo('%s: %s', file, ', '.join(maintainers(file)))
|
23
lib/python/qmk/cli/ping/maintainers.py
Normal file
23
lib/python/qmk/cli/ping/maintainers.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
"""Generate a message to ping people responsible for one or more files.
|
||||
"""
|
||||
from pathlib import Path
|
||||
|
||||
from milc import cli
|
||||
|
||||
from qmk.maintainers import maintainers
|
||||
|
||||
|
||||
@cli.argument("files", type=Path, arg_only=True, nargs='*', help="File to ping maintainers for.")
|
||||
@cli.subcommand("Ping the maintainers for one or more files.")
|
||||
def ping_maintainers(cli):
|
||||
"""List the maintainers for one or more files.
|
||||
"""
|
||||
github_maintainers = set()
|
||||
|
||||
for file in cli.args.files:
|
||||
for maintainer in maintainers(file):
|
||||
if maintainer != 'qmk/collaborators':
|
||||
github_maintainers.add('@' + maintainer)
|
||||
|
||||
if github_maintainers:
|
||||
print(f'If you were pinged by this comment you have one or more files being changed by this PR: {" ".join(sorted(github_maintainers))}')
|
Loading…
Add table
Add a link
Reference in a new issue