diff --git a/astropy_bot/copyedit_checker.py b/astropy_bot/copyedit_checker.py new file mode 100644 index 0000000..8f0c940 --- /dev/null +++ b/astropy_bot/copyedit_checker.py @@ -0,0 +1,34 @@ +from baldrick.plugins.github_pull_requests import pull_request_handler + + +# TODO: we need to note somewhere that if the copyeditor changes, this needs to +# be updated! +COPYEDITOR_GH_HANDLE = 'lglattly' + + +@pull_request_handler +def check_copyedit_docs(pr_handler, repo_handler): + statuses = {} + + if 'docs' in pr_handler.labels: + if 'copyedited' in pr_handler.labels: + statuses['copyedit'] = { + 'description': "This PR has been copyedited.", + 'state': 'success' + } + + else: + statuses['copyedit'] = { + 'description': "This PR modifies the documentation and is " + "waiting for copyediting. No action is needed " + "from the contributor.", + 'state': 'failure' + } + + else: + return None + + if COPYEDITOR_GH_HANDLE not in pr_handler.json['assignees']: + pr_handler.add_assignees(COPYEDITOR_GH_HANDLE) + + return statuses diff --git a/run.py b/run.py index 5c01de6..fb6c4f1 100644 --- a/run.py +++ b/run.py @@ -11,6 +11,7 @@ # Load astropy-specific plugins import astropy_bot.changelog_checker # noqa +import astropy_bot.copyedit_checker # noqa # Bind to PORT if defined, otherwise default to 5000. port = int(os.environ.get('PORT', 5000))