diff --git a/pipeline/frontend/yaml/linter/schema/.woodpecker/test-pipeline-when.yml b/pipeline/frontend/yaml/linter/schema/.woodpecker/test-pipeline-when.yml index 84f02b403..36446a4f9 100644 --- a/pipeline/frontend/yaml/linter/schema/.woodpecker/test-pipeline-when.yml +++ b/pipeline/frontend/yaml/linter/schema/.woodpecker/test-pipeline-when.yml @@ -10,6 +10,9 @@ when: cron: include: - hello + - event: + exclude: pull_request_closed + evaluate: 'CI_COMMIT_AUTHOR == "woodpecker-ci"' steps: echo: diff --git a/pipeline/frontend/yaml/linter/schema/.woodpecker/test-when.yml b/pipeline/frontend/yaml/linter/schema/.woodpecker/test-when.yml index 721c92bf8..485e04890 100644 --- a/pipeline/frontend/yaml/linter/schema/.woodpecker/test-when.yml +++ b/pipeline/frontend/yaml/linter/schema/.woodpecker/test-when.yml @@ -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: diff --git a/pipeline/frontend/yaml/linter/schema/schema.json b/pipeline/frontend/yaml/linter/schema/schema.json index d1b9d97ad..da3eca4b3 100644 --- a/pipeline/frontend/yaml/linter/schema/schema.json +++ b/pipeline/frontend/yaml/linter/schema/schema.json @@ -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": [ {