Compare commits

..

6 commits

Author SHA1 Message Date
eb298a13be feat: post webhook notifications to user
All checks were successful
ci/woodpecker/push/push-next Pipeline was successful
ci/woodpecker/push/tag-created Pipeline was successful
ci/woodpecker/push/cron-docker-builder Pipeline was successful
Closes kemitix/git-next#91
2024-07-23 19:47:38 +01:00
a317fc6648 feat: dispatch NotifyUser messages to server for user (2/2) 2024-07-23 19:37:44 +01:00
d7be6802ef refactor: use Option<&T> over &Option<T> 2024-07-23 19:37:44 +01:00
2239deed4c feat: dispatch NotifyUser messages to server for user (1/2) 2024-07-23 19:37:44 +01:00
17c232b874 feat: support sending messages to the user 2024-07-23 19:37:44 +01:00
715bc60346 WIP: feat: enable configuration of a webhook for receiving notifications 2024-07-23 19:37:44 +01:00

View file

@ -63,7 +63,7 @@ cargo install --path crates/cli
- [x] cli - [x] cli
- [x] server - [x] server
- [x] notifications - notify user when intervention required (e.g. to rebase) - [ ] notifications - notify user when intervention required (e.g. to rebase)
- [ ] tui overview - [ ] tui overview
- [ ] webui overview - [ ] webui overview
@ -204,110 +204,6 @@ Currently `git-next` can only use a `gitdir` if the forge and repo is the
same one specified as the `origin` remote. Otherwise the behaviour is same one specified as the `origin` remote. Otherwise the behaviour is
untested and undefined. untested and undefined.
## Notifications
`git-next` can send a number of notification to the user when intervention is required.
Currently, only WebHooks are supported.
Webhooks are sent using the Standard Webhooks format. That means all POST messages have
the following headers:
- `Webhook-Id`
- `Webhook-Signature`
- `Webhook-Timestamp`
### Events
#### Dev Not Based on Main
This message `type` indicates that the `dev` branch is not based on `main`.
**Action Required**: Rebase the `dev` branch onto the `main` branch.
Sample payload:
```json
{
"data": {
"branches": {
"dev": "dev",
"main": "main"
},
"forge_alias": "jo",
"repo_alias": "kxio"
},
"timestamp": "1721760933",
"type": "branch.dev.not-on-main"
}
```
#### CI Check Failed
This message `type` indicates that the commit on the tip of the `next` branch has failed the
configured CI checks.
**Action Required**: Either update the commit to correct the issue CI raised, or, if the issue
is transient (e.g. a network issue), re-run/re-start the job in your CI.
Sample payload:
```json
{
"data": {
"commit": {
"sha": "98abef1af6825f9770d725a681e5cfc09d7fd4f2",
"message": "feat: add foo to bar template"
},
"forge_alias": "jo",
"repo_alias": "kxio"
},
"timestamp": "1721760933",
"type": "cicheck.failed"
}
```
#### Repo Config Load Failed
This message `type` indicates that `git-next` wasn't able to load the configuration for the
repo from the `git-next.toml` file in the repository.
**Action Required**: Review the `reason` provided.
Sample payload:
```json
{
"data": {
"reason": "File not found: .git-next.toml",
"forge_alias": "jo",
"repo_alias": "kxio"
},
"timestamp": "1721760933",
"type": "config.load.failed"
}
```
#### Webhook Registration Failed
This message `type` indicates that `git-next` wasn't able to register it's webhook with the
forge repository, so will not receive updates when the branches in the repo are updated.
**Action Required**: Review the `reason` provided.
Sample payload:
```json
{
"data": {
"reason": "repo config not loaded",
"forge_alias": "jo",
"repo_alias": "kxio"
},
"timestamp": "1721760933",
"type": "webhook.registration.failed"
}
```
## Behaviour ## Behaviour
The branch names are configurable, but we will talk about `main`, `next` and `dev`. The branch names are configurable, but we will talk about `main`, `next` and `dev`.