Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
17 changes: 0 additions & 17 deletions docs/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
<a href="https://github.com/spack/spackbot" target="_blank">ask me a question</a>. 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.
Binary file removed docs/docs/user-guide/img/ask-for-maintainers.png
Binary file not shown.
Binary file removed docs/docs/user-guide/img/maintainers.png
Binary file not shown.
Binary file removed docs/docs/user-guide/img/spackbot-label.png
Binary file not shown.
Binary file removed docs/docs/user-guide/img/spackbot-labels.png
Binary file not shown.
40 changes: 0 additions & 40 deletions docs/docs/user-guide/user-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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`|
Expand All @@ -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
Expand Down
50 changes: 4 additions & 46 deletions spackbot/comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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.

Expand Down
5 changes: 5 additions & 0 deletions spackbot/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ async def add_comments(event, gh, *args, session, **kwargs):
f'Ignoring request, "{event_project}" does not have pipelines enabled.'
)

# @spackbot <anything else> 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})

Expand Down
Loading