Add release types (#3303)

Co-authored-by: pat-s <patrick.schratz@gmail.com>
This commit is contained in:
Anbraten 2024-01-31 16:18:32 +01:00 committed by GitHub
parent 8429811c94
commit 6ed1655ce3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 27 additions and 2 deletions

View file

@ -38,7 +38,7 @@
- `pull_request`: A pull request event is triggered when a pull request is opened or a new commit is pushed to it.
- `pull_request_closed`: A pull request closed event is triggered when a pull request is closed or merged.
- `tag`: A tag event is triggered when a tag is pushed.
- `release`: A release event is triggered when a release is created.
- `release`: A release event is triggered when a release, pre-release or draft is created. (You can apply further filters using [evaluate](../20-workflow-syntax.md#evaluate) with [environment variables](../50-environment.md#built-in-environment-variables).)
- `manual`: A manual event is triggered when a user manually triggers a pipeline.
- `cron`: A cron event is triggered when a cron job is executed.

View file

@ -757,6 +757,10 @@ when:
### `event`
:::warning
Some events like the release event will be triggered for multiple actions like: releases, pre-releases and drafts. If you want to apply further filters checkout the [evaluate](#evaluate) filter and the available [environment variables](./50-environment.md#built-in-environment-variables).
:::
Execute a step if the build event is a `tag`:
```yaml
@ -783,7 +787,7 @@ Execute a step for all build events:
```yaml
when:
event: [push, pull_request, tag, deployment]
event: [push, pull_request, pull_request_closed, tag, deployment, release]
```
### `ref`

21
server/api/queue.go Normal file
View file

@ -0,0 +1,21 @@
package api
import (
"encoding/json"
"log"
"net/http"
"go.woodpecker-ci.org/woodpecker/v2/server/queue" // replace with the actual import path
)
func GetQueueStats() {
http.HandleFunc("/api/queue/stats", func(w http.ResponseWriter, r *http.Request) {
var stats queue.InfoT
err := json.NewEncoder(w).Encode(stats)
if err != nil {
// handle the error
log.Printf("Error encoding JSON: %v", err)
return
}
})
}