make event in pipeline schema also a constraint_list (#3082)

This commit is contained in:
6543 2023-12-31 08:49:46 +01:00 committed by GitHub
parent 38cf248e41
commit 8b47b3a978
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 60 additions and 12 deletions

View file

@ -10,6 +10,9 @@ when:
cron:
include:
- hello
- event:
exclude: pull_request_closed
evaluate: 'CI_COMMIT_AUTHOR == "woodpecker-ci"'
steps:
echo:

View file

@ -27,6 +27,14 @@ steps:
when:
event: [push, pull_request, tag, deployment]
when-event-exclude-pull_request_closed:
image: alpine
commands:
- echo "test"
when:
event:
exclude: pull_request_closed
when-ref:
image: alpine
commands:

View file

@ -394,18 +394,7 @@
},
"event": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#event",
"oneOf": [
{
"type": "array",
"minLength": 1,
"items": {
"$ref": "#/definitions/event_enum"
}
},
{
"$ref": "#/definitions/event_enum"
}
]
"$ref": "#/definitions/event_constraint_list"
},
"ref": {
"description": "Read more: https://woodpecker-ci.org/docs/usage/pipeline-syntax#ref",
@ -495,6 +484,54 @@
"event_enum": {
"enum": ["push", "pull_request", "pull_request_closed", "tag", "deployment", "cron", "manual"]
},
"event_constraint_list": {
"oneOf": [
{
"$ref": "#/definitions/event_enum"
},
{
"type": "array",
"minLength": 1,
"items": {
"$ref": "#/definitions/event_enum"
}
},
{
"type": "object",
"additionalProperties": false,
"properties": {
"include": {
"oneOf": [
{
"$ref": "#/definitions/event_enum"
},
{
"type": "array",
"minLength": 1,
"items": {
"$ref": "#/definitions/event_enum"
}
}
]
},
"exclude": {
"oneOf": [
{
"$ref": "#/definitions/event_enum"
},
{
"type": "array",
"minLength": 1,
"items": {
"$ref": "#/definitions/event_enum"
}
}
]
}
}
}
]
},
"constraint_list": {
"oneOf": [
{