diff --git a/README.md b/README.md index 44c17a6..5efe209 100644 --- a/README.md +++ b/README.md @@ -5,12 +5,13 @@ This is a GitHub bot for the [Spack](https://github.com/spack/spack) project. It automates various workflow tasks and handles jobs like: -* Notifying maintainers about relevant pull requests; -* Adding maintainers as reviewers if they are in the - [maintainers team](https://github.com/orgs/spack/teams/maintainers) in the - [Spack organization](https://github.com/spack); -* Inviting new maintainers to the maintainers team; and -* Automatically labeling pull requests based on modified files. +* Checking and fixing style on pull requests; +* Running and re-running GitLab CI pipelines; and +* Cleaning up GitLab branches and mirrors when pull requests are closed. + +Labeling pull requests and requesting reviews from package maintainers are +handled by the `triage` GitHub Actions workflow in +[spack-packages](https://github.com/spack/spack-packages), not by spackbot. This list could easily expand in the future. diff --git a/docs/docs/README.md b/docs/docs/README.md index 484b158..69be7e9 100644 --- a/docs/docs/README.md +++ b/docs/docs/README.md @@ -6,9 +6,6 @@ Hi I'm spackbot! 👋 I can help you with [spack](https://github.com/spack/spac - [Ask Spackbot for Help](#help) - [Run Pipelines](#pipelines) - [Style](#style) -- [Labels](#labels) -- [Maintainers](#maintainers) -- [Packages](#packages) ## Quick Start @@ -48,19 +45,5 @@ I'm a hard working robot, so I'll also be helping on the following things withou If your style checks fail (meaning import order, linting, etc.) I'll give you a heads up, and give you a command to run to fix them automatically. If you have write access you can then ask me to fix the style for you. -### Labels - -Don't you love GitHub labels? I do! Whenever you open a pull request, I'll take a peek at what changes you've made and add the appropriate labels. I'm just trying to help the maintainers out! - -### Maintainers - -Are you opening a pull request for a package? I'll help to find and ping maintainers for it! And if there aren't any, I'll start a discussion to figure out who might be able to do it. - And I just might have some other commands and jokes up my sleeve! Want to learn more? Browse the links on the left navigation, or ask me a question. Thanks for stopping by! 😉 - -### Packages - -It's often easier (and faster!) to review pull requests when they are opened for single packages. -Toward this aim, if Spackbot sees that you've opened a pull request that is changing multiple packages, -he will suggest to open a different pull request for each package. diff --git a/docs/docs/user-guide/img/ask-for-maintainers.png b/docs/docs/user-guide/img/ask-for-maintainers.png deleted file mode 100644 index 71289b5..0000000 Binary files a/docs/docs/user-guide/img/ask-for-maintainers.png and /dev/null differ diff --git a/docs/docs/user-guide/img/maintainers.png b/docs/docs/user-guide/img/maintainers.png deleted file mode 100644 index 43ecc0c..0000000 Binary files a/docs/docs/user-guide/img/maintainers.png and /dev/null differ diff --git a/docs/docs/user-guide/img/spackbot-label.png b/docs/docs/user-guide/img/spackbot-label.png deleted file mode 100644 index 550a523..0000000 Binary files a/docs/docs/user-guide/img/spackbot-label.png and /dev/null differ diff --git a/docs/docs/user-guide/img/spackbot-labels.png b/docs/docs/user-guide/img/spackbot-labels.png deleted file mode 100644 index 6c5b182..0000000 Binary files a/docs/docs/user-guide/img/spackbot-labels.png and /dev/null differ diff --git a/docs/docs/user-guide/user-guide.md b/docs/docs/user-guide/user-guide.md index 876c649..5759ec6 100644 --- a/docs/docs/user-guide/user-guide.md +++ b/docs/docs/user-guide/user-guide.md @@ -5,13 +5,10 @@ - [How it works](#how-it-works) - [Interactions](#interactions) - [Commands](#commands) - - [Labels](#labels) - - [Maintainers](#maintainers) - [Hello](#say-hello) - [Help](#help) - [Pipelines](#pipelines) - [Style](#style) - - [Issues](#issues) ## How it works @@ -32,8 +29,6 @@ with different events. | Name | Description | Command | |------|-------------|---------| -|labels| Add labels to newly open pull requests | | -|maintainers| Suggest reviewers (package maintainers) for newly opened pull request | | |hello| Say hello to spackbot | `@spackbot hello`| |help| Ask for help from spackbot | `@spackbot help` or `@spackbot commands`| |pipelines| Ask spackbot to re-run a GitLab pipeline | `@spackbot (re-)run pipelines`| @@ -46,41 +41,6 @@ This is the detailed user guide for interacting with spackbot. Some of these are commands, verbatim, that you can type into a pull request comment to get a response, and others are automated interactions that will always happen for pull requests. -## Labels - -?> automated interaction - -When you open a pull request, spackbot is on the job to help with labels! This -means that he will inspect your changes and add labels that are appropriate. -Here is an example of spackbot seeing a change in fetching logic: - -![img/spackbot-label.png](img/spackbot-label.png) - -or adding more labels for an extensive change to a package: - -![img/spackbot-labels.png](img/spackbot-labels.png) - - -## Maintainers - -?> automated interaction and chat command - -Spackbot is also looking out for packages! When you open a pull request and a package -doesn't have a maintainer, spackbot will make suggestions. - -![img/maintainers.png](img/maintainers.png) - -If for some reason you change the pull request or otherwise want to look for maintainers -again, either of the following will work: - -```bash -@spackbot maintainers -@spackbot request review -``` - -![img/ask-for-maintainers.png](img/ask-for-maintainers.png) - - ## Say Hello ?> chat command diff --git a/spackbot/comments.py b/spackbot/comments.py index 5df3b1b..128f997 100644 --- a/spackbot/comments.py +++ b/spackbot/comments.py @@ -113,12 +113,14 @@ def format_generic_details_msg(msg, details): - `{helpers.botname} run pipeline` or `{helpers.botname} re-run pipeline`: to request a new run of the GitLab CI pipeline - `{helpers.botname} rebuild everything`: to run a pipeline rebuilding all specs from source. - `{helpers.botname} fix style` if you have write and would like me to run `spack style --fix` for you. -- `{helpers.botname} maintainers` or `{helpers.botname} request review`: to look for and assign reviewers for the pull request. -I'll also help to label your pull request and assign reviewers! If you need help or see there might be an issue with me, open an issue [here](https://github.com/spack/spackbot/issues) """ +unknown_command_message = f""" +Sorry, I don't know that command. Say `{helpers.botname} help` to see what I can do! +""" + style_message = f""" It looks like you had an issue with style checks! I can help with that if you ask me! Just say: @@ -135,50 +137,6 @@ def format_generic_details_msg(msg, details): And then update the pull request here. """ -maintainer_request = """ -It looks like you are opening an issue about a package, and we've found maintainers that might be able to help! - -{maintainers} - -""" - - -multiple_packages = """ -Hey there! I noticed that you are adding or updating multiple packages:\n\n - -{packages} - -To get a speedier review for each, I'd like to suggest that you break this into multiple pull requests, with one per package. -""" - - -non_reviewers_comment = """\ - @{non_reviewers} can you review this PR? - - This PR modifies the following package(s), for which you are listed as a maintainer: - - * {packages_with_maintainers} -""" - -no_maintainers_comment = """\ -Hi @{author}! I noticed that the following package(s) don't yet have maintainers: - -* {packages_without_maintainers} - -Are you interested in adopting any of these package(s)? If so, simply add the following to the package class: -```python - maintainers("{author}") -``` -If not, could you contact the developers of this package and see if they are interested? You can quickly see who has worked on a package with `spack blame`: - -```bash -$ spack blame {first_package_without_maintainer} -``` -Thank you for your help! Please don't add maintainers without their consent. - -_You don't have to be a Spack expert or package developer in order to be a "maintainer," it just gives us a list of users willing to review PRs or debug issues relating to this package. A package can have multiple maintainers; just add a list of GitHub handles of anyone who wants to volunteer._ -""" - cannot_run_pipeline_comment = """\ I'm sorry, gitlab does not have your latest revision yet, I can't run that pipeline for you right now. diff --git a/spackbot/routes.py b/spackbot/routes.py index 2d7e19a..78389bd 100644 --- a/spackbot/routes.py +++ b/spackbot/routes.py @@ -114,6 +114,11 @@ async def add_comments(event, gh, *args, session, **kwargs): f'Ignoring request, "{event_project}" does not have pipelines enabled.' ) + # @spackbot at the start of a comment + elif re.match(rf"\s*{helpers.botname}(?![\w-])", comment, re.IGNORECASE): + logger.info(f"Responding to unknown command {comment}...") + message = comments.unknown_command_message + if message: await gh.post(event.data["issue"]["comments_url"], {}, data={"body": message})