Skip to content

Commit

Permalink
Add support for GitHub discussions announcements
Browse files Browse the repository at this point in the history
Signed-off-by: Sergio Castaño Arteaga <[email protected]>
  • Loading branch information
tegioz committed Jun 6, 2024
1 parent 2169347 commit ce7f8c2
Show file tree
Hide file tree
Showing 23 changed files with 55,534 additions and 395 deletions.
2 changes: 2 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
max_width = 110
chain_width = 90
187 changes: 182 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ clap = { version = "4.5.4", features = ["derive"] }
config = "0.13.4"
deadpool-postgres = { version = "0.13.2", features = ["serde"] }
futures = "0.3.30"
graphql_client = { version = "0.14.0", features = ["reqwest"] }
hex = "0.4.3"
hmac = "0.12.1"
http = "0.2.12"
Expand Down
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ To create votes, you'll first need to add a [.gitvote.yml](https://github.com/cn
- At the root of the repository where the vote was created
- At the root of the `.github` repository, for organization wide configuration

Please note that the configuration file is **required** and no commands will be processed if it cannot be found. Once a vote is created, the configuration it will use during its lifetime will be the one present at the vote creation time.
> [!IMPORTANT]
> Please note that the configuration file is **required** and no commands will be processed if it cannot be found. Once a vote is created, the configuration it will use during its lifetime will be the one present at the vote creation time.
For more information about the configuration file format please see the [reference documentation](https://github.com/cncf/gitvote/blob/main/docs/config/.gitvote.yml).

Expand All @@ -34,7 +35,8 @@ The command **must** be on a line by itself. Please note that GitVote only detec

Alternatively, if you have setup multiple configuration profiles, you can also start votes using any of them with the command `/vote-PROFILE`.

Only repositories collaborators can create votes. For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners.
> [!NOTE]
> Only repositories collaborators can create votes. For organization-owned repositories, the list of collaborators includes outside collaborators, organization members that are direct collaborators, organization members with access through team memberships, organization members with access through default organization permissions, and organization owners.
Shortly after the comment with the `/vote` command is posted, the vote will be created and the bot will post a new comment to the corresponding issue or pull request with the vote instructions.

Expand All @@ -56,15 +58,17 @@ It is possible to vote `in favor`, `against` or to `abstain`, and each of these

Only votes from users with a binding vote as defined in the configuration file will be counted.

*Please note that voting multiple options is not allowed and those votes won't be counted.*
> [!WARNING]
> Voting multiple options is not allowed and those votes won't be counted.
### Checking votes

It is possible to check the status of a vote in progress by calling the `/check-vote` command:

![vote-status](docs/screenshots/vote-status.png)

*Please note that this command can only be called once a day per vote (additional calls will be ignored).*
> [!NOTE]
> This command can only be called once a day per vote (additional calls will be ignored).
### Closing votes

Expand All @@ -78,13 +82,26 @@ It is possible to cancel a vote in progress by calling the `/cancel-vote` comman

![vote-cancelled](docs/screenshots/vote-cancelled.png)

### Checks in pull requests (experimental)
### Checks in pull requests

When a vote on a pull request is closed, GitVote will add a check to the head commit with its result. If the vote passes, the result of the check will be *success*, whereas if it doesn't pass, it'll be *failure*. When used in combination with `protected branch`, this feature can be used to *require* a vote in favor before a pull request can be merged.

![check-passed](docs/screenshots/check-passed.png)

At the moment this feature is always enabled but we'll make it configurable so that votes creators can opt-out per configuration profile.
### Announcements

GitVote is able to post announcements on GitHub discussions. When this feature is enabled, a new discussion will be created with the results of the vote once it is closed.

Announcements can be configured per vote profile, by adding the `announcements` configuration section to the `.gitvote.yml` file.

```yaml
announcements:
discussions:
category: Announcements
```
> [!NOTE]
> This feature requires some extra permissions to be able to read and write discussions in your repositories. If you installed the GitVote GitHub application before this feature was available (June 2024), you should receive an email from GitHub requesting you to approve these new permissions. Please note that announcements won't be created until those permissions are granted.
## Adopters
Expand Down
2 changes: 1 addition & 1 deletion charts/gitvote/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: gitvote
description: GitVote is a GitHub application that allows holding a vote on issues and pull requests
type: application
version: 1.2.0
version: 1.2.1-0
appVersion: 1.2.0
kubeVersion: ">= 1.19.0-0"
home: https://gitvote.dev
Expand Down
1 change: 1 addition & 0 deletions charts/gitvote/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Repository:

- **Checks**: *read/write*
- **Contents**: *read*
- **Discussions**: *read/write*
- **Issues**: *read/write*
- **Metadata**: *read*
- **Pull requests**: *read/write*
Expand Down
5 changes: 5 additions & 0 deletions database/migrations/schema/003_issue_title.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alter table vote add column issue_title text;

---- create above / drop below ----

alter table vote drop column issue_title;
Loading

0 comments on commit ce7f8c2

Please sign in to comment.