maintainers.py 796 B

1234567891011121314151617181920212223
  1. """Generate a message to ping people responsible for one or more files.
  2. """
  3. from pathlib import Path
  4. from milc import cli
  5. from qmk.maintainers import maintainers
  6. @cli.argument("files", type=Path, arg_only=True, nargs='*', help="File to ping maintainers for.")
  7. @cli.subcommand("Ping the maintainers for one or more files.")
  8. def ping_maintainers(cli):
  9. """List the maintainers for one or more files.
  10. """
  11. github_maintainers = set()
  12. for file in cli.args.files:
  13. for maintainer in maintainers(file):
  14. if maintainer != 'qmk/collaborators':
  15. github_maintainers.add(maintainer)
  16. if github_maintainers:
  17. print(f'If you were pinged by this comment you have one or more files being changed by this PR: {" ".join(sorted(github_maintainers))}')