Skip to content

Commit

Permalink
add script to check contributor
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Oct 20, 2024
1 parent e10d2d1 commit 404bb41
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions tools/check_contributor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import argparse
import sys

from add_contributors import load_allcontrib, root_dir


def main(argv=sys.argv):
parser = argparse.ArgumentParser(
formatter_class=argparse.RawTextHelpFormatter,
description=("Check if a github username is listed in the BIDS contributors."),
)
parser.add_argument(
"username",
type=str,
help="username to check",
)

args = parser.parse_args(argv[1:])

allcontrib_file = root_dir() / ".all-contributorsrc"
allcontrib = load_allcontrib(allcontrib_file)

if any(args.username == x["login"] for x in allcontrib["contributors"]):
print(f"{args.username} found")
sys.exit(0)

raise ValueError(f"{args.username} not found")


if __name__ == "__main__":
main()

0 comments on commit 404bb41

Please sign in to comment.