From b055063c1f6e43aa93a3ad37af71a59218edb530 Mon Sep 17 00:00:00 2001 From: grantbirki Date: Tue, 28 Mar 2023 11:11:33 +0100 Subject: [PATCH 01/11] init action config validation job --- .github/workflows/action-config-validate.yml | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/action-config-validate.yml diff --git a/.github/workflows/action-config-validate.yml b/.github/workflows/action-config-validate.yml new file mode 100644 index 00000000..7dd5f061 --- /dev/null +++ b/.github/workflows/action-config-validate.yml @@ -0,0 +1,22 @@ +name: action-config-validate +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +permissions: + contents: read + pull-requests: write # enable write permissions for pull request comments + +jobs: + action-config-validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.5.0 + + - name: action-config-validate + uses: GrantBirki/json-yaml-validate@v1.2.0 + with: + comment: "true" # enable comment mode From 0ef6f3221306ecd9d518da2dd7d41baa6b38329c Mon Sep 17 00:00:00 2001 From: grantbirki Date: Tue, 28 Mar 2023 11:33:19 +0100 Subject: [PATCH 02/11] init schema --- .github/workflows/action-config-validate.yml | 2 ++ __tests__/schemas/action.schema.yml | 16 ++++++++++++++++ 2 files changed, 18 insertions(+) create mode 100644 __tests__/schemas/action.schema.yml diff --git a/.github/workflows/action-config-validate.yml b/.github/workflows/action-config-validate.yml index 7dd5f061..aa45cf98 100644 --- a/.github/workflows/action-config-validate.yml +++ b/.github/workflows/action-config-validate.yml @@ -20,3 +20,5 @@ jobs: uses: GrantBirki/json-yaml-validate@v1.2.0 with: comment: "true" # enable comment mode + yaml_schema: "__tests__/schemas/action.schema.yml" + yaml_exclude_regex: "^(?!action.yml$).*$" diff --git a/__tests__/schemas/action.schema.yml b/__tests__/schemas/action.schema.yml new file mode 100644 index 00000000..907e6510 --- /dev/null +++ b/__tests__/schemas/action.schema.yml @@ -0,0 +1,16 @@ +name: + type: string + required: true +description: + type: string + required: true +branding: + type: object + required: true + properties: + icon: + type: string + required: true + color: + type: string + required: true From a399bff7473f21af0e84e3132c0a06de9b5f9630 Mon Sep 17 00:00:00 2001 From: grantbirki Date: Tue, 28 Mar 2023 11:35:17 +0100 Subject: [PATCH 03/11] fix regex --- .github/workflows/action-config-validate.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/action-config-validate.yml b/.github/workflows/action-config-validate.yml index aa45cf98..abf35972 100644 --- a/.github/workflows/action-config-validate.yml +++ b/.github/workflows/action-config-validate.yml @@ -21,4 +21,4 @@ jobs: with: comment: "true" # enable comment mode yaml_schema: "__tests__/schemas/action.schema.yml" - yaml_exclude_regex: "^(?!action.yml$).*$" + yaml_exclude_regex: "^(?!./action.yml$).*$" From b261fddb1e330af0823f87e36cac49695ee9df01 Mon Sep 17 00:00:00 2001 From: grantbirki Date: Tue, 28 Mar 2023 11:36:10 +0100 Subject: [PATCH 04/11] fix --- __tests__/schemas/action.schema.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/__tests__/schemas/action.schema.yml b/__tests__/schemas/action.schema.yml index 907e6510..0031a711 100644 --- a/__tests__/schemas/action.schema.yml +++ b/__tests__/schemas/action.schema.yml @@ -5,12 +5,9 @@ description: type: string required: true branding: - type: object - required: true - properties: - icon: - type: string - required: true - color: - type: string - required: true + icon: + type: string + required: true + color: + type: string + required: true From fe113bc4b3c260c055ad289c274d2f6e8b40e4f8 Mon Sep 17 00:00:00 2001 From: grantbirki Date: Tue, 28 Mar 2023 11:37:49 +0100 Subject: [PATCH 05/11] fixes --- __tests__/schemas/action.schema.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/__tests__/schemas/action.schema.yml b/__tests__/schemas/action.schema.yml index 0031a711..fd7cd9e8 100644 --- a/__tests__/schemas/action.schema.yml +++ b/__tests__/schemas/action.schema.yml @@ -4,6 +4,9 @@ name: description: type: string required: true +author: + type: string + required: true branding: icon: type: string @@ -11,3 +14,13 @@ branding: color: type: string required: true + runs: + using: + type: string + required: true + main: + type: string + required: true + post: + type: string + required: true From 36011d9c3db5cf80f4e292763814cf8125b8737e Mon Sep 17 00:00:00 2001 From: grantbirki Date: Tue, 28 Mar 2023 11:38:47 +0100 Subject: [PATCH 06/11] updates --- __tests__/schemas/action.schema.yml | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/__tests__/schemas/action.schema.yml b/__tests__/schemas/action.schema.yml index fd7cd9e8..66dd05d8 100644 --- a/__tests__/schemas/action.schema.yml +++ b/__tests__/schemas/action.schema.yml @@ -1,3 +1,4 @@ +# Action base info name: type: string required: true @@ -14,13 +15,15 @@ branding: color: type: string required: true - runs: - using: - type: string - required: true - main: - type: string - required: true - post: - type: string - required: true + +# runs section +runs: + using: + type: string + required: true + main: + type: string + required: true + post: + type: string + required: true From ee152a0a06678e59d9f31dcb9fc3a14b0f6e53d2 Mon Sep 17 00:00:00 2001 From: grantbirki Date: Tue, 28 Mar 2023 11:44:23 +0100 Subject: [PATCH 07/11] test --- __tests__/schemas/action.schema.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/__tests__/schemas/action.schema.yml b/__tests__/schemas/action.schema.yml index 66dd05d8..5319b606 100644 --- a/__tests__/schemas/action.schema.yml +++ b/__tests__/schemas/action.schema.yml @@ -27,3 +27,10 @@ runs: post: type: string required: true + +# inputs section +inputs: + required: true + +outputs: + required: true From 44de9f03a90b8d2a42485f8ee164d8177a60bf94 Mon Sep 17 00:00:00 2001 From: grantbirki Date: Tue, 28 Mar 2023 11:53:17 +0100 Subject: [PATCH 08/11] update schema --- __tests__/schemas/action.schema.yml | 335 +++++++++++++++++++++++++++- 1 file changed, 333 insertions(+), 2 deletions(-) diff --git a/__tests__/schemas/action.schema.yml b/__tests__/schemas/action.schema.yml index 5319b606..f1949f5e 100644 --- a/__tests__/schemas/action.schema.yml +++ b/__tests__/schemas/action.schema.yml @@ -30,7 +30,338 @@ runs: # inputs section inputs: - required: true + github_token: + description: + type: string + required: true + default: + type: string + required: true + required: + type: boolean + required: true + status: + description: + type: string + required: true + default: + type: string + required: true + required: + type: boolean + required: true + environment: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + environment_targets: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + environment_urls: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + environment_url_in_comment: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + production_environment: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + reaction: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + trigger: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + noop_trigger: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + lock_trigger: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + unlock_trigger: + description: + type: string + required: true + required: + type: boolean + required: true + help_trigger: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + lock_info_alias: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + global_lock_flag: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + stable_branch: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + prefix_only: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + update_branch: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + required_contexts: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + skip_ci: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + skip_reviews: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + allow_forks: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + admins: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + admins_pat: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + merge_deploy_mode: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true + skip_completing: + description: + type: string + required: true + required: + type: boolean + required: true + default: + type: string + required: true outputs: - required: true + triggered: + description: + type: string + required: true + comment_body: + description: + type: string + required: true + environment: + description: + type: string + required: true + noop: + description: + type: string + required: true + sha: + description: + type: string + required: true + ref: + description: + type: string + required: true + comment_id: + description: + type: string + required: true + type: + description: + type: string + required: true + continue: + description: + type: string + required: true + fork: + description: + type: string + required: true + fork_ref: + description: + type: string + required: true + fork_label: + description: + type: string + required: true + fork_checkout: + description: + type: string + required: true + deployment_id: + description: + type: string + required: true + environment_url: + description: + type: string + required: true + initial_reaction_id: + description: + type: string + required: true + actor_handle: + description: + type: string + required: true + global_lock_claimed: + description: + type: string + required: true + global_lock_released: + description: + type: string + required: true From 00b40fe6f7aaee609c9a5a91c839246dd5a174ed Mon Sep 17 00:00:00 2001 From: grantbirki Date: Tue, 28 Mar 2023 12:00:04 +0100 Subject: [PATCH 09/11] fixes --- __tests__/schemas/action.schema.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/__tests__/schemas/action.schema.yml b/__tests__/schemas/action.schema.yml index f1949f5e..4788ad3c 100644 --- a/__tests__/schemas/action.schema.yml +++ b/__tests__/schemas/action.schema.yml @@ -79,7 +79,7 @@ inputs: required: true default: type: string - required: true + required: false environment_url_in_comment: description: type: string @@ -147,6 +147,9 @@ inputs: required: type: boolean required: true + default: + type: string + required: true help_trigger: description: type: string @@ -226,7 +229,7 @@ inputs: required: true default: type: string - required: true + required: false skip_reviews: description: type: string @@ -236,7 +239,7 @@ inputs: required: true default: type: string - required: true + required: false allow_forks: description: type: string @@ -288,6 +291,7 @@ inputs: type: string required: true +# outputs section outputs: triggered: description: @@ -341,6 +345,10 @@ outputs: description: type: string required: true + fork_full_name: + description: + type: string + required: true deployment_id: description: type: string From 3a425139740b9f5d0d32bbdac625945e29be2d08 Mon Sep 17 00:00:00 2001 From: grantbirki Date: Tue, 28 Mar 2023 12:04:14 +0100 Subject: [PATCH 10/11] rename --- ...on-config-validate.yml => actions-config-validation.yml} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename .github/workflows/{action-config-validate.yml => actions-config-validation.yml} (83%) diff --git a/.github/workflows/action-config-validate.yml b/.github/workflows/actions-config-validation.yml similarity index 83% rename from .github/workflows/action-config-validate.yml rename to .github/workflows/actions-config-validation.yml index abf35972..f29cbcb7 100644 --- a/.github/workflows/action-config-validate.yml +++ b/.github/workflows/actions-config-validation.yml @@ -1,4 +1,4 @@ -name: action-config-validate +name: actions-config-validation on: push: branches: @@ -11,12 +11,12 @@ permissions: pull-requests: write # enable write permissions for pull request comments jobs: - action-config-validate: + actions-config-validation: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3.5.0 - - name: action-config-validate + - name: actions-config-validation uses: GrantBirki/json-yaml-validate@v1.2.0 with: comment: "true" # enable comment mode From 7c90dded122eaeb56a37fe64f0b3517a341b08a4 Mon Sep 17 00:00:00 2001 From: grantbirki Date: Tue, 28 Mar 2023 12:04:52 +0100 Subject: [PATCH 11/11] add new badge --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 004f8c29..b2e0cfc9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Branch Deploy Action 🚀 -[![CodeQL](https://github.com/github/branch-deploy/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/github/branch-deploy/actions/workflows/codeql-analysis.yml) [![test](https://github.com/github/branch-deploy/actions/workflows/test.yml/badge.svg)](https://github.com/github/branch-deploy/actions/workflows/test.yml) [![package-check](https://github.com/github/branch-deploy/actions/workflows/package-check.yml/badge.svg)](https://github.com/github/branch-deploy/actions/workflows/package-check.yml) [![lint](https://github.com/github/branch-deploy/actions/workflows/lint.yml/badge.svg)](https://github.com/github/branch-deploy/actions/workflows/lint.yml) [![coverage](./badges/coverage.svg)](./badges/coverage.svg) +[![CodeQL](https://github.com/github/branch-deploy/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/github/branch-deploy/actions/workflows/codeql-analysis.yml) [![test](https://github.com/github/branch-deploy/actions/workflows/test.yml/badge.svg)](https://github.com/github/branch-deploy/actions/workflows/test.yml) [![package-check](https://github.com/github/branch-deploy/actions/workflows/package-check.yml/badge.svg)](https://github.com/github/branch-deploy/actions/workflows/package-check.yml) [![lint](https://github.com/github/branch-deploy/actions/workflows/lint.yml/badge.svg)](https://github.com/github/branch-deploy/actions/workflows/lint.yml) [![actions-config-validation](https://github.com/github/branch-deploy/actions/workflows/actions-config-validation.yml/badge.svg)](https://github.com/github/branch-deploy/actions/workflows/actions-config-validation.yml) [![coverage](./badges/coverage.svg)](./badges/coverage.svg) A GitHub Action to enable branch deployments using IssueOps!