You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/installation.md
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,18 @@
1
1
Installation
2
2
============
3
3
4
-
Buffy works listening to events received from GitHub and deciding if/how to reply by passing the received payload to different Responders.
5
-
You can fork Buffy and configure the responders you want to use for any specific repository. There is no need for the Buffy fork to be located in the same GitHub user/organization as the repo where it will be used. To have Buffy ready and listening to events you can install it locally or deploy it to a server or service platform.
6
-
You'll need the following components:
4
+
Buffy functions by monitoring events that are sent from a GitHub repository (e.g., openjournals/joss-reviews). Based on the information in these events, Buffy determines whether and how to respond by passing the event data to different [Responders](https://api.rubyonrails.org/v4.1/classes/ActionController/Responder.html).
7
5
8
-
- A GitHub user to use as the bot with admin permissions on the target repo (usually a member of the organization owning the repo).
6
+
You can fork Buffy and configure the responders you want to use for a particular repository, and the fork doesn't necessarily
7
+
need to be hosted under the same GitHub user or organization (as the repository where it will be used). For Buffy to be operational, it must be running either through a local installation or deployment to a platform. The following components are necessary for this setup:
8
+
9
+
- A GitHub user with administrative permissions on the target repository (typically a member of the organization that owns the repository) is required to act as the bot.
9
10
- An instance of Buffy running
10
-
- A webhook configured in the GitHub repo's settings to send events to Buffy
11
+
- A webhook configured in the settings of the GitHub repository that will send events to Buffy (e.g., a `reviews` repository).
11
12
12
13
### Create the bot GitHub user
13
14
14
-
This will be the user responding to commands in the reviews repo.
15
+
This will be the "user" responding to the commands issued from a reviews repository.
15
16
16
17
**1.**[Sign up at GitHub](https://github.com/join) and create the bot user:
17
18
@@ -40,13 +41,13 @@ Some applications and services must be available to use by Buffy:
40
41
41
42
#### Deployment
42
43
43
-
We will use here [Heroku](https://www.heroku.com)as an example service to deploy Buffy but you can use any other server or platform.
44
+
As an example, we will use [Heroku](https://www.heroku.com) to deploy Buffy. However, any other server or platform can also be used.
44
45
45
-
**1.**Create a new app in heroku linked to the url of your fork of Buffy. Automatically Heroku will use the `heroku/ruby` buildpack.
46
+
**1.**To begin, create a new app in Heroku linked to the URL of your Buffy fork. Heroku will automatically use the `heroku/ruby` buildpack.
46
47
47
-
- To process background jobs Buffy needs `redis`installed, several add-ons providing it are available: Heroku Redis, RedisGreen, Redis To Go, etc.
48
-
-To install the `cloc` dependency there's a buildpack for Heroku available [here](https://github.com/openjournals/heroku-buildpack-cloc).
49
-
-Gitinspector can be installed [using npm](https://www.npmjs.com/package/gitinspector). To do so in Heroku, the `heroku/nodejs` buildpack can be added.
48
+
- To process background jobs, Buffy needs a `redis` add-on, such as Heroku Redis or RedisGreen etc.
49
+
-You can use [this Heroku buildpack](https://github.com/openjournals/heroku-buildpack-cloc) to install the `cloc` dependency.
50
+
-You can install Gitinspector using npm by following the instructions [here](https://www.npmjs.com/package/gitinspector). If you plan to deploy to Heroku, you can add the `heroku/nodejs` buildpack to your app.
50
51
51
52
**2.** In the app settings add the following Config Vars:
52
53
@@ -64,23 +65,24 @@ We will use here [Heroku](https://www.heroku.com) as an example service to deplo
64
65
65
66
There are detailed instructions in the Deploy section of your Heroku app.
66
67
67
-
**4.**You should now have a public URL with Buffy running. You can test that pointing your browser to `/status`, like for example: `https://your-new-buffy-deploy.herokuapp.com/status` It should return a simple *up and running* message.
68
+
**4.**At this point, you should have a public URL pointing to your new Buffy app! To confirm this, you can test it by visiting https://your-new-buffy-deploy.herokuapp.com/status. On success, you should see a basic (*up and running*) message confirming that Buffy is up and running.
68
69
69
70
70
71
### Configure a webhook to send events from GitHub to Buffy
71
72
72
-
**1.**Go to the settings page of the repository where you want to use buffy. Add a new webhook.
73
+
**1.**Navigate to the settings page of the repository that Buffy will be listening to and add a new webhook.
**2.**Set up the new webhook with the following configuration:
77
78
78
79
Payload URL: /dispatch path at your public buffy url
79
80
Content type: application/json
80
81
Secret: The BUFFY_GH_SECRET_TOKEN you configured in the previous step
81
82
82
83
Select individual events to trigger: **issue comments** and **issues**
84
+
83
85

84
86
85
87
86
-
If everything went well you should have now your bot responding on the reviews issues. Try `@botname help`for example.
88
+
Assuming everything went smoothly, your Buffy instance should now be responding to review issues. You can test this by sending the `@botname help`command from a reviews issue to verify that the bot is functioning as expected.
Copy file name to clipboardExpand all lines: docs/responders/github_action.md
+23-16Lines changed: 23 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
GitHub Action
2
2
=============
3
3
4
-
This responder triggers workflow run on a GitHub Action using the GitHub API. Optionally if the call is successful (not the result of the workflow run but the call to trigger it) a reply message can be posted as a comment in the issue.
4
+
This `buffy`responder dispatches an event to trigger a GitHub Action workflow in a repository, where the workflow is defined by a `.github/workflows/*.yaml` file. If desired, upon a successful event dispatch to trigger the workflow (not the outcome of the workflow run), a reply message can be posted as a comment in the (corresponding review) issue.
5
5
Allows [labeling](../labeling).
6
6
7
7
## Listens to
@@ -17,7 +17,7 @@ For example, if you configure the command to be _compile pdf_, it will respond t
17
17
18
18
## Requirements
19
19
20
-
Some parameters are required for the responder to work: the `command` to invoke it, and the `workflow_repo` and `workflow_name` values to identify the action to run. All can be set using the settings YAML file.
20
+
Some parameters are required for the responder to work: the `command` to invoke it, and the `workflow_repo` and `workflow_name` values to identify the action to run. All can be set using the respective settings YAML file (e.g., `buffy/config/settings-<environment>.yml`).
21
21
22
22
## Settings key
23
23
@@ -54,22 +54,29 @@ If you want to run multiple responders, use an array of these subparams.
54
54
## Examples
55
55
56
56
**A complete example:**
57
+
58
+
The following snippet sets up `buffy` to react to a `@editorialbot generate pdf` command issued during a `joss` review:
59
+
57
60
```yaml
58
61
...
59
62
github_action:
60
-
only: editors
61
-
command: compile pdf
62
-
description: Generates a PDF based on the paper.md file in the repository
63
-
workflow_repo: openjournals/reviews
64
-
workflow_name: compile-pdf.yml
65
-
inputs:
66
-
file: paper.md
67
-
data-from-issue:
68
-
- branch
69
-
- target_repository
70
-
mapping:
71
-
repository: target_repository
72
-
number: issue_id
63
+
- draft_paper:
64
+
command: generate pdf
65
+
workflow_repo: openjournals/joss-papers
66
+
workflow_name: draft-paper.yml
67
+
workflow_ref: master
68
+
description: Generates the pdf paper
69
+
data_from_issue:
70
+
- branch
71
+
- target-repository
72
+
- issue_id
73
+
mapping:
74
+
repository_url: target-repository
73
75
...
74
76
```
75
-
Once the responder is invoked it triggers the _compile-pdf.yml_ workflow on the _openjournals/reviews_ repository passing to it the _file_, _repository_, _branch_ and _number_ inputs.
77
+
78
+
Once invoked, this `github_action` responder triggers the [_draft-paper_](https://github.com/openjournals/joss-papers/blob/main/.github/workflows/draft-paper.yml) workflow on the [_openjournals/joss-papers_](https://github.com/openjournals/joss-papers) repository (see the [actions tab](https://github.com/openjournals/joss-papers/actions)).
79
+
80
+
The `data_from_issue` field lists the values of _branch_, _target-repository_, and _issue-id_ (which `buffy` fetches from a review issue body) that serve as input arguments for this action. The optional `mapping` field indicates that the value _target-repository_ is mapped to the _repository_url_ variable.
81
+
82
+
For additional use cases, please refer to the complete [`settings-production.yml`](https://github.com/openjournals/buffy/blob/joss/config/settings-production.yml) file located under the `joss` branch of `buffy`.
0 commit comments