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: cron:
include: include:
- hello - hello
- event:
exclude: pull_request_closed
evaluate: 'CI_COMMIT_AUTHOR == "woodpecker-ci"'
steps: steps:
echo: echo:

View file

@ -27,6 +27,14 @@ steps:
when: when:
event: [push, pull_request, tag, deployment] 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: when-ref:
image: alpine image: alpine
commands: commands:

View file

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