From 300c0dc569ef49b789cc38bab216d393df9bbcf7 Mon Sep 17 00:00:00 2001 From: Lawrence Gripper Date: Wed, 24 Sep 2025 10:36:32 +0000 Subject: [PATCH] Add support to language parser --- workflow-parser/src/workflow-v1.0.json | 57 +++++++++++++++++++ ...vent-config-image-version-name-version.yml | 42 ++++++++++++++ .../on-event-config-image-version-names.yml | 49 ++++++++++++++++ ...on-event-config-image-version-versions.yml | 49 ++++++++++++++++ .../on-event-config-string-image-version.yml | 39 +++++++++++++ 5 files changed, 236 insertions(+) create mode 100644 workflow-parser/testdata/reader/on-event-config-image-version-name-version.yml create mode 100644 workflow-parser/testdata/reader/on-event-config-image-version-names.yml create mode 100644 workflow-parser/testdata/reader/on-event-config-image-version-versions.yml create mode 100644 workflow-parser/testdata/reader/on-event-config-string-image-version.yml diff --git a/workflow-parser/src/workflow-v1.0.json b/workflow-parser/src/workflow-v1.0.json index 5e24de2..6faa40e 100644 --- a/workflow-parser/src/workflow-v1.0.json +++ b/workflow-parser/src/workflow-v1.0.json @@ -99,6 +99,7 @@ "discussion_comment": "discussion-comment", "fork": "fork", "gollum": "gollum", + "image_version": "image-version", "issue_comment": "issue-comment", "issues": "issues", "label": "label", @@ -140,6 +141,7 @@ "discussion-comment-string", "fork-string", "gollum-string", + "image-version-string", "issue-comment-string", "issues-string", "label-string", @@ -436,6 +438,47 @@ "description": "Runs your workflow when someone creates or updates a Wiki page.", "null": {} }, + "image-version-string": { + "description": "Runs your workflow when an image version is created or changes state.", + "string": { + "constant": "image_version" + } + }, + "image-version": { + "description": "Runs your workflow when an image version is created or changes state.", + "one-of": [ + "null", + "image-version-mapping" + ] + }, + "image-version-mapping": { + "mapping": { + "properties": { + "types": "image-version-activity", + "names": "event-names", + "versions": "event-versions" + } + } + }, + "image-version-activity": { + "description": "The types of image version activity that trigger the workflow. Supported activity types: `created`, `ready`, `deleted`.", + "one-of": [ + "image-version-activity-type", + "image-version-activity-types" + ] + }, + "image-version-activity-types": { + "sequence": { + "item-type": "image-version-activity-type" + } + }, + "image-version-activity-type": { + "allowed-values": [ + "created", + "ready", + "deleted" + ] + }, "issue-comment-string": { "description": "Runs your workflow when an issue or pull request comment is created, edited, or deleted.", "string": { @@ -1221,6 +1264,13 @@ "sequence-of-non-empty-string" ] }, + "event-names": { + "description": "Use the `names` filter when you want to include names via patterns or when you want to both include and exclude names using patterns. ", + "one-of": [ + "non-empty-string", + "sequence-of-non-empty-string" + ] + }, "event-tags": { "description": "Use the `tags` filter when you want to include tag name patterns or when you want to both include and exclude tag names patterns. You cannot use both the `tags` and `tags-ignore` filters for the same event in a workflow.", "one-of": [ @@ -1249,6 +1299,13 @@ "sequence-of-non-empty-string" ] }, + "event-versions": { + "description": "Use the `versions` filter when you want to include versions via patterns or when you want to both include and exclude versions using patterns. ", + "one-of": [ + "non-empty-string", + "sequence-of-non-empty-string" + ] + }, "repository-dispatch-string": { "description": "You can use the GitHub API to trigger a webhook event called `repository_dispatch` when you want to trigger a workflow for activity that happens outside of GitHub.", "string": { diff --git a/workflow-parser/testdata/reader/on-event-config-image-version-name-version.yml b/workflow-parser/testdata/reader/on-event-config-image-version-name-version.yml new file mode 100644 index 0000000..6a5b5ff --- /dev/null +++ b/workflow-parser/testdata/reader/on-event-config-image-version-name-version.yml @@ -0,0 +1,42 @@ +include-source: false +skip: + - C# + - Go +--- +on: + image_version: + names: testing + versions: 1.* +jobs: + my-job: + runs-on: ubuntu-latest + steps: + - run: echo hi +--- +{ + "events": { + "image_version": {} + }, + "jobs": [ + { + "type": "job", + "id": "my-job", + "name": "my-job", + "if": { + "type": 3, + "expr": "success()" + }, + "runs-on": "ubuntu-latest", + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + } + ] +} \ No newline at end of file diff --git a/workflow-parser/testdata/reader/on-event-config-image-version-names.yml b/workflow-parser/testdata/reader/on-event-config-image-version-names.yml new file mode 100644 index 0000000..34f733f --- /dev/null +++ b/workflow-parser/testdata/reader/on-event-config-image-version-names.yml @@ -0,0 +1,49 @@ +include-source: false +skip: + - C# + - Go +--- +on: + image_version: + types: + - ready + names: + - one + - two +jobs: + my-job: + runs-on: ubuntu-latest + steps: + - run: echo hi +--- +{ + "events": { + "image_version": { + "types": [ + "ready" + ] + } + }, + "jobs": [ + { + "type": "job", + "id": "my-job", + "name": "my-job", + "if": { + "type": 3, + "expr": "success()" + }, + "runs-on": "ubuntu-latest", + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + } + ] +} \ No newline at end of file diff --git a/workflow-parser/testdata/reader/on-event-config-image-version-versions.yml b/workflow-parser/testdata/reader/on-event-config-image-version-versions.yml new file mode 100644 index 0000000..c50ca7e --- /dev/null +++ b/workflow-parser/testdata/reader/on-event-config-image-version-versions.yml @@ -0,0 +1,49 @@ +include-source: false +skip: + - C# + - Go +--- +on: + image_version: + types: + - ready + versions: + - "1.0.0" + - "1.0.1" +jobs: + my-job: + runs-on: ubuntu-latest + steps: + - run: echo hi +--- +{ + "events": { + "image_version": { + "types": [ + "ready" + ] + } + }, + "jobs": [ + { + "type": "job", + "id": "my-job", + "name": "my-job", + "if": { + "type": 3, + "expr": "success()" + }, + "runs-on": "ubuntu-latest", + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + } + ] +} diff --git a/workflow-parser/testdata/reader/on-event-config-string-image-version.yml b/workflow-parser/testdata/reader/on-event-config-string-image-version.yml new file mode 100644 index 0000000..9ac6dd6 --- /dev/null +++ b/workflow-parser/testdata/reader/on-event-config-string-image-version.yml @@ -0,0 +1,39 @@ +include-source: false +skip: + - C# + - Go +--- +on: image_version +jobs: + my-job: + runs-on: ubuntu-latest + steps: + - run: echo hi +--- +{ + "events": { + "image_version": {} + }, + "jobs": [ + { + "type": "job", + "id": "my-job", + "name": "my-job", + "if": { + "type": 3, + "expr": "success()" + }, + "runs-on": "ubuntu-latest", + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + } + ] +}