Skip to content

Commit

Permalink
make event in pipeline schema also a constraint_list (woodpecker-ci#3082
Browse files Browse the repository at this point in the history
)
  • Loading branch information
6543 authored and fernandrone committed Feb 1, 2024
1 parent 0f4cfc7 commit 935947a
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ when:
cron:
include:
- hello
- event:
exclude: pull_request_closed
evaluate: 'CI_COMMIT_AUTHOR == "woodpecker-ci"'

steps:
echo:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
61 changes: 49 additions & 12 deletions pipeline/frontend/yaml/linter/schema/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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": [
{
Expand Down

0 comments on commit 935947a

Please sign in to comment.