diff --git a/actions-workflow-parser/testdata/reader/concurrency.yml b/actions-workflow-parser/testdata/reader/concurrency.yml index ad07011..b230bef 100644 --- a/actions-workflow-parser/testdata/reader/concurrency.yml +++ b/actions-workflow-parser/testdata/reader/concurrency.yml @@ -3,7 +3,7 @@ skip: - TypeScript --- on: push -concurrency: +concurrency: group: ${{ github.ref }} cancel-in-progress: true jobs: @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - run: echo hi continue-on-error: true - concurrency: + concurrency: group: ${{ github.ref }} cancel-in-progress: true build2: @@ -24,7 +24,7 @@ jobs: concurrency: staging build4: runs-on: macos-latest - concurrency: + concurrency: group: ref cancel-in-progress: ${{ github.ref }} diff --git a/actions-workflow-parser/testdata/reader/errors-insert.yml b/actions-workflow-parser/testdata/reader/errors-insert.yml new file mode 100644 index 0000000..6506202 --- /dev/null +++ b/actions-workflow-parser/testdata/reader/errors-insert.yml @@ -0,0 +1,23 @@ +include-source: false # Drop file/line/col from output +--- +on: push +jobs: + run: + runs-on: ubuntu-latest + env: + bad_insert1: "This is a bad ${{ insert }}" + bad_insert2: "${{ insert }} are bad at the beginning" + ${{ insert }}: ${{ github.ref }} + steps: + - run: echo hi +--- +{ + "errors": [ + { + "Message": ".github/workflows/errors-insert.yml (Line: 6, Col: 20): The directive 'insert' is not allowed in this context. Directives are not supported for expressions that are embedded within a string. Directives are only supported when the entire value is an expression." + }, + { + "Message": ".github/workflows/errors-insert.yml (Line: 7, Col: 20): The directive 'insert' is not allowed in this context. Directives are not supported for expressions that are embedded within a string. Directives are only supported when the entire value is an expression." + } + ] +} diff --git a/actions-workflow-parser/testdata/reader/errors-invalid-mapping-key.yml b/actions-workflow-parser/testdata/reader/errors-invalid-mapping-key.yml new file mode 100644 index 0000000..1611363 --- /dev/null +++ b/actions-workflow-parser/testdata/reader/errors-invalid-mapping-key.yml @@ -0,0 +1,19 @@ +include-source: false # Drop file/line/col from output +skip: + - TypeScript +--- +on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - null : ' ' + run: echo {{ 😀 }} +--- +{ + "errors": [ + { + "Message": ".github/workflows/errors-invalid-mapping-key.yml (Line: 6, Col: 9): Unexpected value ''" + } + ] +} \ No newline at end of file diff --git a/actions-workflow-parser/testdata/reader/errors-job-runs-on-group-invalid-prefix.yml b/actions-workflow-parser/testdata/reader/errors-job-runs-on-group-invalid-prefix.yml index 2b35981..1c8e3c7 100644 --- a/actions-workflow-parser/testdata/reader/errors-job-runs-on-group-invalid-prefix.yml +++ b/actions-workflow-parser/testdata/reader/errors-job-runs-on-group-invalid-prefix.yml @@ -15,7 +15,7 @@ jobs: steps: - run: echo hi build3: - runs-on: + runs-on: group: ent/ steps: - run: echo hi diff --git a/actions-workflow-parser/testdata/reader/errors-matrix-bad-key.yml b/actions-workflow-parser/testdata/reader/errors-matrix-bad-key.yml new file mode 100644 index 0000000..164ca3a --- /dev/null +++ b/actions-workflow-parser/testdata/reader/errors-matrix-bad-key.yml @@ -0,0 +1,19 @@ +include-source: false # Drop file/line/col from output +--- +on: push +jobs: + bad-strategy-key: + strategy: + bad-key: + os: [10] + runs-on: macos-latest + steps: + - run: echo hi +--- +{ + "errors": [ + { + "Message": ".github/workflows/errors-matrix-bad-key.yml (Line: 5, Col: 7): Unexpected value 'bad-key'" + } + ] +} \ No newline at end of file diff --git a/actions-workflow-parser/testdata/reader/errors-matrix-empty-vector.yml b/actions-workflow-parser/testdata/reader/errors-matrix-empty-vector.yml new file mode 100644 index 0000000..6c4a744 --- /dev/null +++ b/actions-workflow-parser/testdata/reader/errors-matrix-empty-vector.yml @@ -0,0 +1,22 @@ +include-source: false # Drop file/line/col from output +skip: + - TypeScript +--- +on: push +jobs: + empty-vector: + strategy: + matrix: + os: [] + version: [10,12] + runs-on: macos-latest + steps: + - run: echo hi +--- +{ + "errors": [ + { + "Message": ".github/workflows/errors-matrix-empty-vector.yml (Line: 6, Col: 13): Matrix vector 'os' does not contain any values" + } + ] +} \ No newline at end of file diff --git a/actions-workflow-parser/testdata/reader/errors-max-depth.yml b/actions-workflow-parser/testdata/reader/errors-max-depth.yml index 539fbee..7076f8d 100644 --- a/actions-workflow-parser/testdata/reader/errors-max-depth.yml +++ b/actions-workflow-parser/testdata/reader/errors-max-depth.yml @@ -1,7 +1,7 @@ include-source: false # Drop file/line/col from output -max-depth: 5 skip: - TypeScript +max-depth: 5 --- on: push jobs: diff --git a/actions-workflow-parser/testdata/reader/errors-max-file-size.yml b/actions-workflow-parser/testdata/reader/errors-max-file-size.yml index ec56b7b..832bf53 100644 --- a/actions-workflow-parser/testdata/reader/errors-max-file-size.yml +++ b/actions-workflow-parser/testdata/reader/errors-max-file-size.yml @@ -1,7 +1,7 @@ include-source: false # Drop file/line/col from output -max-file-size: 124 skip: - TypeScript +max-file-size: 124 --- on: push jobs: diff --git a/actions-workflow-parser/testdata/reader/errors-max-result-size.yml b/actions-workflow-parser/testdata/reader/errors-max-result-size.yml index 67a93c7..82306fa 100644 --- a/actions-workflow-parser/testdata/reader/errors-max-result-size.yml +++ b/actions-workflow-parser/testdata/reader/errors-max-result-size.yml @@ -1,7 +1,7 @@ include-source: false # Drop file/line/col from output -max-result-size: 768 skip: - TypeScript +max-result-size: 768 --- on: push jobs: diff --git a/actions-workflow-parser/testdata/reader/errors-reusable-workflow-max-result-size.yml b/actions-workflow-parser/testdata/reader/errors-reusable-workflow-max-result-size.yml index 1b32531..567a3e4 100644 --- a/actions-workflow-parser/testdata/reader/errors-reusable-workflow-max-result-size.yml +++ b/actions-workflow-parser/testdata/reader/errors-reusable-workflow-max-result-size.yml @@ -1,8 +1,8 @@ include-source: false # Drop file/line/col from output max-result-size: 2048 skip: - - TypeScript - Go + - TypeScript --- on: push jobs: diff --git a/actions-workflow-parser/testdata/reader/escape-html-values.yml b/actions-workflow-parser/testdata/reader/escape-html-values.yml index 5138f67..2fb679a 100644 --- a/actions-workflow-parser/testdata/reader/escape-html-values.yml +++ b/actions-workflow-parser/testdata/reader/escape-html-values.yml @@ -12,7 +12,7 @@ jobs: steps: - run: echo Hello && World #string token build2: - if: false + if: false runs-on: ubuntu-latest steps: - run: echo 1 diff --git a/actions-workflow-parser/testdata/reader/float-folded-style.yml b/actions-workflow-parser/testdata/reader/float-folded-style.yml new file mode 100644 index 0000000..bd28b60 --- /dev/null +++ b/actions-workflow-parser/testdata/reader/float-folded-style.yml @@ -0,0 +1,49 @@ +include-source: false # Drop file/line/col from output +skip: + - TypeScript +--- +on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Switch to using Python 3.10 by default + uses: actions/setup-python@v4 + with: + python-version: >- + 3.10 +--- +{ + "jobs": [ + { + "type": "job", + "id": "build", + "name": "build", + "if": { + "type": 3, + "expr": "success()" + }, + "runs-on": "ubuntu-latest", + "steps": [ + { + "id": "__actions_setup-python", + "name": "Switch to using Python 3.10 by default", + "if": { + "type": 3, + "expr": "success()" + }, + "uses": "actions/setup-python@v4", + "with": { + "type": 2, + "map": [ + { + "Key": "python-version", + "Value": "3.10" + } + ] + } + } + ] + } + ] +} \ No newline at end of file diff --git a/actions-workflow-parser/testdata/reader/insert.yml b/actions-workflow-parser/testdata/reader/insert.yml new file mode 100644 index 0000000..11f7d95 --- /dev/null +++ b/actions-workflow-parser/testdata/reader/insert.yml @@ -0,0 +1,94 @@ +include-source: false # Drop file/line/col from output +skip: + - TypeScript +--- +on: push +jobs: + generate: + runs-on: ubuntu-latest + outputs: + matrix_map: ${{ steps.set-matrix.outputs.matrix }} + steps: + - run: echo hi + run: + runs-on: ubuntu-latest + needs: generate + env: + ${{ insert }}: ${{ fromJson(needs.generate.outputs.matrix_map) }} + steps: + - run: echo hi +--- +{ + "jobs": [ + { + "type": "job", + "id": "generate", + "name": "generate", + "if": { + "type": 3, + "expr": "success()" + }, + "runs-on": "ubuntu-latest", + "outputs": { + "type": 2, + "map": [ + { + "Key": "matrix_map", + "Value": { + "type": 3, + "expr": "steps.set-matrix.outputs.matrix" + } + } + ] + }, + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + }, + { + "type": "job", + "id": "run", + "name": "run", + "needs": [ + "generate" + ], + "if": { + "type": 3, + "expr": "success()" + }, + "env": { + "type": 2, + "map": [ + { + "Key": { + "type": 4, + "directive": "insert" + }, + "Value": { + "type": 3, + "expr": "fromJson(needs.generate.outputs.matrix_map)" + } + } + ] + }, + "runs-on": "ubuntu-latest", + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + } + ] +} diff --git a/actions-workflow-parser/testdata/reader/job-if.yml b/actions-workflow-parser/testdata/reader/job-if.yml index bfa5a5b..ef715cf 100644 --- a/actions-workflow-parser/testdata/reader/job-if.yml +++ b/actions-workflow-parser/testdata/reader/job-if.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest steps: - run: echo hi - build4: + build4: needs: - build - build2 diff --git a/actions-workflow-parser/testdata/reader/matrix-basic.yml b/actions-workflow-parser/testdata/reader/matrix-basic.yml new file mode 100644 index 0000000..d6f1e91 --- /dev/null +++ b/actions-workflow-parser/testdata/reader/matrix-basic.yml @@ -0,0 +1,285 @@ +include-source: false # Drop file/line/col from output +skip: + - TypeScript +--- +on: push +jobs: + matrix-basic: + strategy: + matrix: + version: [10, 12, 14] + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - run: echo hi + matrix-nested-sequences: + strategy: + matrix: + version: [[[[10]],2],12,14] + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - run: echo hi + matrix-with-infinity: + strategy: + matrix: + version: [1, 999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999] + os: [ubuntu-latest, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - run: echo hi + nested-matrix: + strategy: + matrix: { vector1: [ {foo: {bar: baz} } ] } + runs-on: linux + steps: + - run: echo hi +--- +{ + "jobs": [ + { + "type": "job", + "id": "matrix-basic", + "name": "matrix-basic", + "if": { + "type": 3, + "expr": "success()" + }, + "strategy": { + "type": 2, + "map": [ + { + "Key": "matrix", + "Value": { + "type": 2, + "map": [ + { + "Key": "version", + "Value": { + "type": 1, + "seq": [ + 10, + 12, + 14 + ] + } + }, + { + "Key": "os", + "Value": { + "type": 1, + "seq": [ + "ubuntu-latest", + "windows-latest" + ] + } + } + ] + } + } + ] + }, + "runs-on": { + "type": 3, + "expr": "matrix.os" + }, + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + }, + { + "type": "job", + "id": "matrix-nested-sequences", + "name": "matrix-nested-sequences", + "if": { + "type": 3, + "expr": "success()" + }, + "strategy": { + "type": 2, + "map": [ + { + "Key": "matrix", + "Value": { + "type": 2, + "map": [ + { + "Key": "version", + "Value": { + "type": 1, + "seq": [ + { + "type": 1, + "seq": [ + { + "type": 1, + "seq": [ + { + "type": 1, + "seq": [ + 10 + ] + } + ] + }, + 2 + ] + }, + 12, + 14 + ] + } + }, + { + "Key": "os", + "Value": { + "type": 1, + "seq": [ + "ubuntu-latest", + "windows-latest" + ] + } + } + ] + } + } + ] + }, + "runs-on": { + "type": 3, + "expr": "matrix.os" + }, + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + }, + { + "type": "job", + "id": "matrix-with-infinity", + "name": "matrix-with-infinity", + "if": { + "type": 3, + "expr": "success()" + }, + "strategy": { + "type": 2, + "map": [ + { + "Key": "matrix", + "Value": { + "type": 2, + "map": [ + { + "Key": "version", + "Value": { + "type": 1, + "seq": [ + 1, + "Infinity" + ] + } + }, + { + "Key": "os", + "Value": { + "type": 1, + "seq": [ + "ubuntu-latest", + "windows-latest" + ] + } + } + ] + } + } + ] + }, + "runs-on": { + "type": 3, + "expr": "matrix.os" + }, + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + }, + { + "type": "job", + "id": "nested-matrix", + "name": "nested-matrix", + "if": { + "type": 3, + "expr": "success()" + }, + "strategy": { + "type": 2, + "map": [ + { + "Key": "matrix", + "Value": { + "type": 2, + "map": [ + { + "Key": "vector1", + "Value": { + "type": 1, + "seq": [ + { + "type": 2, + "map": [ + { + "Key": "foo", + "Value": { + "type": 2, + "map": [ + { + "Key": "bar", + "Value": "baz" + } + ] + } + } + ] + } + ] + } + } + ] + } + } + ] + }, + "runs-on": "linux", + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + } + ] +} \ No newline at end of file diff --git a/actions-workflow-parser/testdata/reader/misc-jobs.yml b/actions-workflow-parser/testdata/reader/misc-jobs.yml index ca88646..417c527 100644 --- a/actions-workflow-parser/testdata/reader/misc-jobs.yml +++ b/actions-workflow-parser/testdata/reader/misc-jobs.yml @@ -10,7 +10,7 @@ jobs: name: ${{ github.actor }} timeout-minutes: ${{ github.ref }} cancel-timeout-minutes: 300 - concurrency: + concurrency: group: ${{ github.ref }} cancel-in-progress: true env: @@ -28,10 +28,10 @@ jobs: build2: runs-on: [self-hosted, linux] continue-on-error: true - name: Jobs Repro Hardcode + name: Jobs Repro Hardcode timeout-minutes: 360 cancel-timeout-minutes: 300 - concurrency: + concurrency: group: groupA cancel-in-progress: true env: diff --git a/actions-workflow-parser/testdata/reader/on-workflow_dispatch-inputs-null.yml b/actions-workflow-parser/testdata/reader/on-workflow_dispatch-inputs-null.yml index c1a963d..f65c6b2 100644 --- a/actions-workflow-parser/testdata/reader/on-workflow_dispatch-inputs-null.yml +++ b/actions-workflow-parser/testdata/reader/on-workflow_dispatch-inputs-null.yml @@ -1,6 +1,6 @@ include-source: false # Drop file/line/col from output skip: - - Typescript + - TypeScript --- on: workflow_dispatch: diff --git a/actions-workflow-parser/testdata/reader/on-workflow_dispatch-inputs.yml b/actions-workflow-parser/testdata/reader/on-workflow_dispatch-inputs.yml index 56920d2..b97e1f1 100644 --- a/actions-workflow-parser/testdata/reader/on-workflow_dispatch-inputs.yml +++ b/actions-workflow-parser/testdata/reader/on-workflow_dispatch-inputs.yml @@ -1,7 +1,6 @@ include-source: false # Drop file/line/col from output skip: - - Go - - Typescript + - TypeScript --- on: workflow_dispatch: @@ -22,6 +21,10 @@ on: - debug # Defaults to string input4: + input5-Env: + description: 'Test environment' + type: environment + required: true jobs: my-job: runs-on: ubuntu-latest @@ -33,7 +36,8 @@ jobs: "input1": "string", "input2": "boolean", "input3": "choice", - "input4": "string" + "input4": "string", + "input5-Env": "environment" }, "jobs": [ { diff --git a/actions-workflow-parser/testdata/reader/on-workflow_dispatch-unknown-keys-ignored.yml b/actions-workflow-parser/testdata/reader/on-workflow_dispatch-unknown-keys-ignored.yml index 2b53084..ee2019a 100644 --- a/actions-workflow-parser/testdata/reader/on-workflow_dispatch-unknown-keys-ignored.yml +++ b/actions-workflow-parser/testdata/reader/on-workflow_dispatch-unknown-keys-ignored.yml @@ -1,6 +1,6 @@ include-source: false # Drop file/line/col from output skip: - - Typescript + - TypeScript --- on: workflow_dispatch: diff --git a/actions-workflow-parser/testdata/reader/permissions.yml b/actions-workflow-parser/testdata/reader/permissions.yml index 54ba0de..df6f689 100644 --- a/actions-workflow-parser/testdata/reader/permissions.yml +++ b/actions-workflow-parser/testdata/reader/permissions.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/checkout@v3 - run: echo hi continue-on-error: true - deploy: + deploy: runs-on: ubuntu-latest permissions: actions: write diff --git a/actions-workflow-parser/testdata/reader/preserves-source-info-basic.yml b/actions-workflow-parser/testdata/reader/preserves-source-info-basic.yml index 9063438..9c16081 100644 --- a/actions-workflow-parser/testdata/reader/preserves-source-info-basic.yml +++ b/actions-workflow-parser/testdata/reader/preserves-source-info-basic.yml @@ -1,6 +1,5 @@ include-source: true # Preserve file/line/col in serialized output skip: - - Go - TypeScript --- on: push diff --git a/actions-workflow-parser/testdata/reader/preserves-source-info-reusable-workflow.yml b/actions-workflow-parser/testdata/reader/preserves-source-info-reusable-workflow.yml index f7ed89e..acf4c70 100644 --- a/actions-workflow-parser/testdata/reader/preserves-source-info-reusable-workflow.yml +++ b/actions-workflow-parser/testdata/reader/preserves-source-info-reusable-workflow.yml @@ -33,46 +33,34 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": { + "type": "reusableWorkflowJob", + "id": { "type": 0, "file": 1, "line": 3, "col": 3, "lit": "build" }, - "Name": { + "name": { "type": 0, "file": 1, "line": 3, "col": 3, "lit": "build" }, - "Needs": [], - "If": { + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": { + "ref": { "type": 0, "file": 1, "line": 4, "col": 11, "lit": "some-org-1/some-repo-1/.github/workflows/build.yml@v1" }, - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": { @@ -120,46 +108,34 @@ jobs: ] }, { - "Type": "reusableWorkflowJob", - "Id": { + "type": "reusableWorkflowJob", + "id": { "type": 0, "file": 1, "line": 5, "col": 3, "lit": "deploy" }, - "Name": { + "name": { "type": 0, "file": 1, "line": 5, "col": 3, "lit": "deploy" }, - "Needs": [], - "If": { + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": { + "ref": { "type": 0, "file": 1, "line": 6, "col": 11, "lit": "some-org-2/some-repo-2/.github/workflows/deploy.yml@v2" }, - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": { diff --git a/actions-workflow-parser/testdata/reader/preserves-source-info-simple.yml b/actions-workflow-parser/testdata/reader/preserves-source-info-simple.yml index e7797df..75303ce 100644 --- a/actions-workflow-parser/testdata/reader/preserves-source-info-simple.yml +++ b/actions-workflow-parser/testdata/reader/preserves-source-info-simple.yml @@ -3,7 +3,7 @@ skip: - TypeScript --- # This is meant to cover all the different types of TemplateToken that are output -# with include-source: true. Currently it is missing type 4 (insert expression) +# with include-source: true. Currently it is missing type 4 (insert expression) # and type 7 (null), once we have matrix strategy we should be able to get null or combine # this test with preserves-source-info-basic.yml. on: push diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-inputs.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-inputs.yml index 0e209c6..cd82fa4 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-inputs.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-inputs.yml @@ -53,17 +53,16 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": { + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "input-definitions": { "type": 2, "map": [ { @@ -200,7 +199,7 @@ jobs: } ] }, - "InputValues": { + "input-values": { "type": 2, "map": [ { @@ -229,16 +228,7 @@ jobs: } ] }, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "deploy", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-job-basic.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-job-basic.yml index b4721ab..9d9c070 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-job-basic.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-job-basic.yml @@ -66,19 +66,18 @@ jobs: ] }, { - "Type": "reusableWorkflowJob", - "Id": "deploy-1", - "Name": "deploy-1", - "Needs": [ + "type": "reusableWorkflowJob", + "id": "deploy-1", + "name": "deploy-1", + "needs": [ "build" ], - "If": { + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/deploy.yml@v1", - "Permissions": null, - "InputDefinitions": { + "ref": "contoso/templates/.github/workflows/deploy.yml@v1", + "input-definitions": { "type": 2, "map": [ { @@ -99,7 +98,7 @@ jobs: } ] }, - "InputValues": { + "input-values": { "type": 2, "map": [ { @@ -108,7 +107,7 @@ jobs: } ] }, - "SecretDefinitions": { + "secret-definitions": { "type": 2, "map": [ { @@ -129,7 +128,7 @@ jobs: } ] }, - "SecretValues": { + "secret-values": { "type": 2, "map": [ { @@ -141,14 +140,7 @@ jobs: } ] }, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "job1", @@ -184,19 +176,18 @@ jobs: ] }, { - "Type": "reusableWorkflowJob", - "Id": "deploy-2", - "Name": "deploy-2", - "Needs": [ + "type": "reusableWorkflowJob", + "id": "deploy-2", + "name": "deploy-2", + "needs": [ "build" ], - "If": { + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/deploy.yml@v1", - "Permissions": null, - "InputDefinitions": { + "ref": "contoso/templates/.github/workflows/deploy.yml@v1", + "input-definitions": { "type": 2, "map": [ { @@ -217,7 +208,7 @@ jobs: } ] }, - "InputValues": { + "input-values": { "type": 2, "map": [ { @@ -226,7 +217,7 @@ jobs: } ] }, - "SecretDefinitions": { + "secret-definitions": { "type": 2, "map": [ { @@ -247,15 +238,8 @@ jobs: } ] }, - "SecretValues": null, - "InheritSecrets": true, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "inherit-secrets": true, + "jobs": [ { "type": "job", "id": "job1", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-job-inputs-type-coercion.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-job-inputs-type-coercion.yml index 31c89cb..dbe138c 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-job-inputs-type-coercion.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-job-inputs-type-coercion.yml @@ -35,17 +35,16 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "deploy", - "Name": "deploy", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "deploy", + "name": "deploy", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/deploy.yml@v1", - "Permissions": null, - "InputDefinitions": { + "ref": "contoso/templates/.github/workflows/deploy.yml@v1", + "input-definitions": { "type": 2, "map": [ { @@ -98,7 +97,7 @@ jobs: } ] }, - "InputValues": { + "input-values": { "type": 2, "map": [ { @@ -119,16 +118,7 @@ jobs: } ] }, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "job1", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-job-name.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-job-name.yml index 5b52215..60c8c3c 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-job-name.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-job-name.yml @@ -26,28 +26,16 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "jobs": [ { "type": "job", "id": "build-it", @@ -71,28 +59,16 @@ jobs: ] }, { - "Type": "reusableWorkflowJob", - "Id": "build1", - "Name": "custom name", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build1", + "name": "custom name", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "jobs": [ { "type": "job", "id": "build-it", @@ -116,31 +92,19 @@ jobs: ] }, { - "Type": "reusableWorkflowJob", - "Id": "build2", - "Name": { + "type": "reusableWorkflowJob", + "id": "build2", + "name": { "type": 3, "expr": "github.ref" }, - "Needs": [], - "If": { + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "jobs": [ { "type": "job", "id": "build-it", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-job-nested-basic.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-job-nested-basic.yml index 9ae18a1..ec93258 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-job-nested-basic.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-job-nested-basic.yml @@ -28,51 +28,27 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "deploy-level-0", - "Name": "deploy-level-0", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "deploy-level-0", + "name": "deploy-level-0", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/deploy-level-1.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "ref": "contoso/templates/.github/workflows/deploy-level-1.yml@v1", + "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "deploy-level-1", - "Name": "deploy-level-1", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "deploy-level-1", + "name": "deploy-level-1", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/deploy-level-2.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "ref": "contoso/templates/.github/workflows/deploy-level-2.yml@v1", + "jobs": [ { "type": "job", "id": "deploy-level-1", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-job-nested-multiple.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-job-nested-multiple.yml new file mode 100644 index 0000000..de28ff1 --- /dev/null +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-job-nested-multiple.yml @@ -0,0 +1,205 @@ +include-source: false # Drop file/line/col from output +skip: + - Go + - TypeScript +max-nested-reusable-workflows-depth: 2 +--- +on: push +jobs: + a: + uses: contoso/templates/.github/workflows/deploy-level-1a.yml@v1 + b: + uses: contoso/templates/.github/workflows/deploy-level-1b.yml@v1 + c: + uses: contoso/templates/.github/workflows/deploy-level-1c.yml@v1 +--- +contoso/templates/.github/workflows/deploy-level-1a.yml@v1 +--- +on: workflow_call +jobs: + deploy-level-1a: + uses: contoso/templates/.github/workflows/deploy-level-2a.yml@v1 +--- +contoso/templates/.github/workflows/deploy-level-2a.yml@v1 +--- +on: workflow_call +jobs: + deploy-level-2a: + runs-on: ubuntu-latest + steps: + - run: echo hi +--- +contoso/templates/.github/workflows/deploy-level-1b.yml@v1 +--- +on: workflow_call +jobs: + deploy-level-1b: + uses: contoso/templates/.github/workflows/deploy-level-2b.yml@v1 +--- +contoso/templates/.github/workflows/deploy-level-2b.yml@v1 +--- +on: workflow_call +jobs: + deploy-level-2b: + runs-on: ubuntu-latest + steps: + - run: echo hi +--- +contoso/templates/.github/workflows/deploy-level-1c.yml@v1 +--- +on: workflow_call +jobs: + deploy-level-1c: + uses: contoso/templates/.github/workflows/deploy-level-2c.yml@v1 +--- +contoso/templates/.github/workflows/deploy-level-2c.yml@v1 +--- +on: workflow_call +jobs: + deploy-level-2c: + runs-on: ubuntu-latest + steps: + - run: echo hi +--- +{ + "jobs": [ + { + "type": "reusableWorkflowJob", + "id": "a", + "name": "a", + "needs": [], + "if": { + "type": 3, + "expr": "success()" + }, + "ref": "contoso/templates/.github/workflows/deploy-level-1a.yml@v1", + "jobs": [ + { + "type": "reusableWorkflowJob", + "id": "deploy-level-1a", + "name": "deploy-level-1a", + "needs": [], + "if": { + "type": 3, + "expr": "success()" + }, + "ref": "contoso/templates/.github/workflows/deploy-level-2a.yml@v1", + "jobs": [ + { + "type": "job", + "id": "deploy-level-2a", + "name": "deploy-level-2a", + "if": { + "type": 3, + "expr": "success()" + }, + "runs-on": "ubuntu-latest", + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + } + ] + } + ] + }, + { + "type": "reusableWorkflowJob", + "id": "b", + "name": "b", + "needs": [], + "if": { + "type": 3, + "expr": "success()" + }, + "ref": "contoso/templates/.github/workflows/deploy-level-1b.yml@v1", + "jobs": [ + { + "type": "reusableWorkflowJob", + "id": "deploy-level-1b", + "name": "deploy-level-1b", + "needs": [], + "if": { + "type": 3, + "expr": "success()" + }, + "ref": "contoso/templates/.github/workflows/deploy-level-2b.yml@v1", + "jobs": [ + { + "type": "job", + "id": "deploy-level-2b", + "name": "deploy-level-2b", + "if": { + "type": 3, + "expr": "success()" + }, + "runs-on": "ubuntu-latest", + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + } + ] + } + ] + }, + { + "type": "reusableWorkflowJob", + "id": "c", + "name": "c", + "needs": [], + "if": { + "type": 3, + "expr": "success()" + }, + "ref": "contoso/templates/.github/workflows/deploy-level-1c.yml@v1", + "jobs": [ + { + "type": "reusableWorkflowJob", + "id": "deploy-level-1c", + "name": "deploy-level-1c", + "needs": [], + "if": { + "type": 3, + "expr": "success()" + }, + "ref": "contoso/templates/.github/workflows/deploy-level-2c.yml@v1", + "jobs": [ + { + "type": "job", + "id": "deploy-level-2c", + "name": "deploy-level-2c", + "if": { + "type": 3, + "expr": "success()" + }, + "runs-on": "ubuntu-latest", + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + } + ] + } + ] + } + ] +} diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-job-nested-permissions.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-job-nested-permissions.yml index f8b78fd..773dd93 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-job-nested-permissions.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-job-nested-permissions.yml @@ -42,80 +42,47 @@ jobs: }, "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "deploy-level-0", - "Name": "deploy-level-0", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "deploy-level-0", + "name": "deploy-level-0", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/deploy-level-1.yml@v1", - "Permissions": { + "ref": "contoso/templates/.github/workflows/deploy-level-1.yml@v1", + "permissions": { "actions": "write" }, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "deploy-level-1", - "Name": "deploy-level-1", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "deploy-level-1", + "name": "deploy-level-1", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/deploy-level-2.yml@v1", - "Permissions": { + "ref": "contoso/templates/.github/workflows/deploy-level-2.yml@v1", + "permissions": { "actions": "read" }, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "deploy-level-3", - "Name": "deploy-level-3", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "deploy-level-3", + "name": "deploy-level-3", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/deploy-level-3.yml@v1", - "Permissions": { + "ref": "contoso/templates/.github/workflows/deploy-level-3.yml@v1", + "permissions": { "actions": "read" }, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "deploy-level-3", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-embedded-permissions-after-jobs.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-embedded-permissions-after-jobs.yml index 58a2555..e613903 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-embedded-permissions-after-jobs.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-embedded-permissions-after-jobs.yml @@ -47,30 +47,19 @@ permissions: }, "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": { + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "permissions": { "actions": "write" }, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "deploy", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-embedded-permissions.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-embedded-permissions.yml index b0d0b14..47ce8d1 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-embedded-permissions.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-embedded-permissions.yml @@ -47,30 +47,19 @@ jobs: }, "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": { + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "permissions": { "actions": "read" }, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "deploy", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-overrides-default-limited-read.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-overrides-default-limited-read.yml index 4eaca32..d6fb3b6 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-overrides-default-limited-read.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-overrides-default-limited-read.yml @@ -27,28 +27,16 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "jobs": [ { "type": "job", "id": "deploy", @@ -72,30 +60,19 @@ jobs: ] }, { - "Type": "reusableWorkflowJob", - "Id": "build2", - "Name": "build2", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build2", + "name": "build2", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": { + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "permissions": { "actions": "write" }, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "deploy", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-overrides-default-limited-write.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-overrides-default-limited-write.yml index b9a0e5d..e9fa67a 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-overrides-default-limited-write.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-overrides-default-limited-write.yml @@ -27,28 +27,16 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "jobs": [ { "type": "job", "id": "deploy", @@ -72,30 +60,19 @@ jobs: ] }, { - "Type": "reusableWorkflowJob", - "Id": "build2", - "Name": "build2", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build2", + "name": "build2", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": { + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "permissions": { "actions": "write" }, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "deploy", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-overrides-workflow-level.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-overrides-workflow-level.yml index 6833b2f..7f096d0 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-overrides-workflow-level.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-job-permissions-overrides-workflow-level.yml @@ -32,30 +32,19 @@ jobs: }, "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": { + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "permissions": { "actions": "read" }, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "deploy", @@ -82,30 +71,19 @@ jobs: ] }, { - "Type": "reusableWorkflowJob", - "Id": "build2", - "Name": "build2", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build2", + "name": "build2", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": { + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "permissions": { "actions": "write" }, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "deploy", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-job-strategy.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-job-strategy.yml index adbe218..cd35281 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-job-strategy.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-job-strategy.yml @@ -31,17 +31,16 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": { + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "input-definitions": { "type": 2, "map": [ { @@ -58,7 +57,7 @@ jobs: } ] }, - "InputValues": { + "input-values": { "type": 2, "map": [ { @@ -70,15 +69,7 @@ jobs: } ] }, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": { + "strategy": { "type": 2, "map": [ { @@ -101,7 +92,7 @@ jobs: } ] }, - "Jobs": [ + "jobs": [ { "type": "job", "id": "build-it", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-multiple.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-multiple.yml index 4b4a31c..959dfc1 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-multiple.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-multiple.yml @@ -33,28 +33,16 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "jobs": [ { "type": "job", "id": "deploy", @@ -78,28 +66,16 @@ jobs: ] }, { - "Type": "reusableWorkflowJob", - "Id": "build2", - "Name": "build2", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build2", + "name": "build2", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso2/templates2/.github/workflows/build2.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "ref": "contoso2/templates2/.github/workflows/build2.yml@v1", + "jobs": [ { "type": "job", "id": "deploy2", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-no-inputs.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-no-inputs.yml index 5550cd7..df0edad 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-no-inputs.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-no-inputs.yml @@ -21,28 +21,16 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "jobs": [ { "type": "job", "id": "deploy", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-outputs.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-outputs.yml index 6ef098c..c567cac 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-outputs.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-outputs.yml @@ -27,22 +27,16 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": null, - "SecretValues": null, - "InheritSecrets": false, - "Outputs": { + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "outputs": { "type": 2, "map": [ { @@ -66,12 +60,7 @@ jobs: } ] }, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "job1", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-secrets-secret-without-definition.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-secrets-secret-without-definition.yml index 883d3d6..2c8e078 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-secrets-secret-without-definition.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-secrets-secret-without-definition.yml @@ -25,19 +25,16 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": { + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "secret-definitions": { "type": 2, "map": [ { @@ -46,7 +43,7 @@ jobs: } ] }, - "SecretValues": { + "secret-values": { "type": 2, "map": [ { @@ -58,14 +55,7 @@ jobs: } ] }, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "deploy", diff --git a/actions-workflow-parser/testdata/reader/reusable-workflow-secrets.yml b/actions-workflow-parser/testdata/reader/reusable-workflow-secrets.yml index 40cda81..7514011 100644 --- a/actions-workflow-parser/testdata/reader/reusable-workflow-secrets.yml +++ b/actions-workflow-parser/testdata/reader/reusable-workflow-secrets.yml @@ -32,19 +32,16 @@ jobs: { "jobs": [ { - "Type": "reusableWorkflowJob", - "Id": "build", - "Name": "build", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build", + "name": "build", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": { + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "secret-definitions": { "type": 2, "map": [ { @@ -61,7 +58,7 @@ jobs: } ] }, - "SecretValues": { + "secret-values": { "type": 2, "map": [ { @@ -73,14 +70,7 @@ jobs: } ] }, - "InheritSecrets": false, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "jobs": [ { "type": "job", "id": "deploy", @@ -104,19 +94,16 @@ jobs: ] }, { - "Type": "reusableWorkflowJob", - "Id": "build2", - "Name": "build2", - "Needs": [], - "If": { + "type": "reusableWorkflowJob", + "id": "build2", + "name": "build2", + "needs": [], + "if": { "type": 3, "expr": "success()" }, - "Ref": "contoso/templates/.github/workflows/build.yml@v1", - "Permissions": null, - "InputDefinitions": null, - "InputValues": null, - "SecretDefinitions": { + "ref": "contoso/templates/.github/workflows/build.yml@v1", + "secret-definitions": { "type": 2, "map": [ { @@ -133,15 +120,8 @@ jobs: } ] }, - "SecretValues": null, - "InheritSecrets": true, - "Outputs": null, - "Defaults": null, - "Env": null, - "Concurrency": null, - "EmbeddedConcurrency": null, - "Strategy": null, - "Jobs": [ + "inherit-secrets": true, + "jobs": [ { "type": "job", "id": "deploy", diff --git a/actions-workflow-parser/testdata/reader/step-id-generates-counter-per-collision.yml b/actions-workflow-parser/testdata/reader/step-id-generates-counter-per-collision.yml index 0713335..f588b88 100644 --- a/actions-workflow-parser/testdata/reader/step-id-generates-counter-per-collision.yml +++ b/actions-workflow-parser/testdata/reader/step-id-generates-counter-per-collision.yml @@ -6,10 +6,12 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: Actions/Capitalized@v2 - uses: actions/setup-node@v2 - uses: docker://alpine:latest - run: echo hello - uses: actions/checkout@v2 + - uses: Actions/Capitalized@v2 - uses: actions/setup-node@v3 - uses: docker://alpine:latest - run: echo hello @@ -34,6 +36,14 @@ jobs: }, "uses": "actions/checkout@v2" }, + { + "id": "__Actions_Capitalized", + "if": { + "type": 3, + "expr": "success()" + }, + "uses": "Actions/Capitalized@v2" + }, { "id": "__actions_setup-node", "if": { @@ -66,6 +76,14 @@ jobs: }, "uses": "actions/checkout@v2" }, + { + "id": "__Actions_Capitalized_2", + "if": { + "type": 3, + "expr": "success()" + }, + "uses": "Actions/Capitalized@v2" + }, { "id": "__actions_setup-node_2", "if": { diff --git a/actions-workflow-parser/testdata/reader/yaml-schema-bool.yml b/actions-workflow-parser/testdata/reader/yaml-schema-bool.yml index b0bbd06..9100be9 100644 --- a/actions-workflow-parser/testdata/reader/yaml-schema-bool.yml +++ b/actions-workflow-parser/testdata/reader/yaml-schema-bool.yml @@ -1,6 +1,4 @@ include-source: false # Drop file/line/col from output -skip: - - Go --- on: push jobs: diff --git a/actions-workflow-parser/testdata/reader/yaml-schema-exceptions.yml b/actions-workflow-parser/testdata/reader/yaml-schema-exceptions.yml new file mode 100644 index 0000000..70de47f --- /dev/null +++ b/actions-workflow-parser/testdata/reader/yaml-schema-exceptions.yml @@ -0,0 +1,77 @@ +include-source: false # Drop file/line/col from output +--- +on: push +env: + UNDERSCORED_INT_AS_STRING: 12_345 + UNDERSCORED_FLOAT_AS_STRING: 23_456.789_321 +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + vector-1: + - 12_345 + - 23_456.789_321 + steps: + - run: echo hi +--- +{ + "env": { + "type": 2, + "map": [ + { + "Key": "UNDERSCORED_INT_AS_STRING", + "Value": "12_345" + }, + { + "Key": "UNDERSCORED_FLOAT_AS_STRING", + "Value": "23_456.789_321" + } + ] + }, + "jobs": [ + { + "type": "job", + "id": "build", + "name": "build", + "if": { + "type": 3, + "expr": "success()" + }, + "strategy": { + "type": 2, + "map": [ + { + "Key": "matrix", + "Value": { + "type": 2, + "map": [ + { + "Key": "vector-1", + "Value": { + "type": 1, + "seq": [ + "12_345", + "23_456.789_321" + ] + } + } + ] + } + } + ] + }, + "runs-on": "ubuntu-latest", + "steps": [ + { + "id": "__run", + "if": { + "type": 3, + "expr": "success()" + }, + "run": "echo hi" + } + ] + } + ] +} diff --git a/actions-workflow-parser/testdata/reader/yaml-schema-float.yml b/actions-workflow-parser/testdata/reader/yaml-schema-float.yml index 2531ab8..fb7f36f 100644 --- a/actions-workflow-parser/testdata/reader/yaml-schema-float.yml +++ b/actions-workflow-parser/testdata/reader/yaml-schema-float.yml @@ -1,6 +1,5 @@ include-source: false # Drop file/line/col from output skip: - - Go - TypeScript --- on: push diff --git a/actions-workflow-parser/testdata/reader/yaml-schema-int.yml b/actions-workflow-parser/testdata/reader/yaml-schema-int.yml index c571fa3..a6189c4 100644 --- a/actions-workflow-parser/testdata/reader/yaml-schema-int.yml +++ b/actions-workflow-parser/testdata/reader/yaml-schema-int.yml @@ -1,6 +1,4 @@ include-source: false # Drop file/line/col from output -skip: - - Go --- on: push jobs: diff --git a/actions-workflow-parser/testdata/reader/yaml-schema-null.yml b/actions-workflow-parser/testdata/reader/yaml-schema-null.yml index 86d09a0..6349637 100644 --- a/actions-workflow-parser/testdata/reader/yaml-schema-null.yml +++ b/actions-workflow-parser/testdata/reader/yaml-schema-null.yml @@ -1,6 +1,5 @@ include-source: false # Drop file/line/col from output skip: - - Go - TypeScript --- on: push diff --git a/actions-workflow-parser/testdata/reader/yaml-schema-sequence.yml b/actions-workflow-parser/testdata/reader/yaml-schema-sequence.yml index c285c3e..8d458f7 100644 --- a/actions-workflow-parser/testdata/reader/yaml-schema-sequence.yml +++ b/actions-workflow-parser/testdata/reader/yaml-schema-sequence.yml @@ -1,6 +1,5 @@ include-source: false # Drop file/line/col from output skip: - - Go - TypeScript --- on: push diff --git a/actions-workflow-parser/testdata/reader/yaml-schema-str-block-styles.yml b/actions-workflow-parser/testdata/reader/yaml-schema-str-block-styles.yml index e474ae6..026d4ef 100644 --- a/actions-workflow-parser/testdata/reader/yaml-schema-str-block-styles.yml +++ b/actions-workflow-parser/testdata/reader/yaml-schema-str-block-styles.yml @@ -1,6 +1,4 @@ include-source: false # Drop file/line/col from output -skip: - - Go --- on: push jobs: diff --git a/actions-workflow-parser/testdata/reader/yaml-schema-str-flow-styles.yml b/actions-workflow-parser/testdata/reader/yaml-schema-str-flow-styles.yml index 092a72f..9f2a87c 100644 --- a/actions-workflow-parser/testdata/reader/yaml-schema-str-flow-styles.yml +++ b/actions-workflow-parser/testdata/reader/yaml-schema-str-flow-styles.yml @@ -1,6 +1,5 @@ include-source: false # Drop file/line/col from output skip: - - Go - TypeScript --- on: push @@ -35,7 +34,7 @@ jobs: # Customer-breaking change we discovered when upgrading from YamlDotNet.Signed 6.0.0 to YamlDotNet 12.0.2. # YamlDotNet 12.0.2 produces the error "While scanning a multi-line double-quoted scalar, found wrong indentation." - - "hello + - "hello world" steps: diff --git a/actions-workflow-parser/testdata/reader/yaml-schema-string.yml b/actions-workflow-parser/testdata/reader/yaml-schema-string.yml index 41ed76d..cc9ca28 100644 --- a/actions-workflow-parser/testdata/reader/yaml-schema-string.yml +++ b/actions-workflow-parser/testdata/reader/yaml-schema-string.yml @@ -1,6 +1,6 @@ include-source: false # Drop file/line/col from output skip: -- TypeScript + - TypeScript --- on: push jobs: @@ -12,6 +12,14 @@ jobs: dot: . single-quoted-number: '8' double-quoted-number: "9" + hex-number: 0xCB2431 + hex-string: "0xCB2431" + # binary-number: 0b10100111001 // Binary numbers are not supported by C# at the moment + # binary-string: "0b1111" + octal-number: 0o1234567 + octal-string: "0o1234567" + python-version: >- + 3.10 --- { "jobs": [ @@ -46,6 +54,26 @@ jobs: { "Key": "double-quoted-number", "Value": "9" + }, + { + "Key": "hex-number", + "Value": "13313073" + }, + { + "Key": "hex-string", + "Value": "0xCB2431" + }, + { + "Key": "octal-number", + "Value": "342391" + }, + { + "Key": "octal-string", + "Value": "0o1234567" + }, + { + "Key": "python-version", + "Value": "3.10" } ] } diff --git a/actions-workflow-parser/testdata/reader/yaml-schema-timestamp.yml b/actions-workflow-parser/testdata/reader/yaml-schema-timestamp.yml index 26ab729..c722fb9 100644 --- a/actions-workflow-parser/testdata/reader/yaml-schema-timestamp.yml +++ b/actions-workflow-parser/testdata/reader/yaml-schema-timestamp.yml @@ -1,6 +1,6 @@ include-source: false # Drop file/line/col from output skip: -- TypeScript + - TypeScript --- on: push jobs: