From 97736d0588f35dadd2571553d3c02685c947d676 Mon Sep 17 00:00:00 2001 From: Igor Rodionov Date: Thu, 7 Dec 2023 02:25:39 +0100 Subject: [PATCH] Incupsulate configs --- .github/workflows/test-matrix-2-levels.yml | 1 + .github/workflows/test-matrix-3-levels.yml | 1 + .github/workflows/test-positive.yml | 1 + action.yml | 6 +++--- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-matrix-2-levels.yml b/.github/workflows/test-matrix-2-levels.yml index b81b670..9bb65c2 100644 --- a/.github/workflows/test-matrix-2-levels.yml +++ b/.github/workflows/test-matrix-2-levels.yml @@ -25,6 +25,7 @@ jobs: id: current with: atmos-gitops-config-path: "./tests/atmos-gitops.yaml" + select-filter: '.settings.github.actions_enabled // false' nested-matrices-count: '2' outputs: diff --git a/.github/workflows/test-matrix-3-levels.yml b/.github/workflows/test-matrix-3-levels.yml index a52c44b..43626e5 100644 --- a/.github/workflows/test-matrix-3-levels.yml +++ b/.github/workflows/test-matrix-3-levels.yml @@ -26,6 +26,7 @@ jobs: id: current with: atmos-gitops-config-path: "./tests/atmos-gitops.yaml" + select-filter: '.settings.github.actions_enabled // false' nested-matrices-count: '3' outputs: diff --git a/.github/workflows/test-positive.yml b/.github/workflows/test-positive.yml index c17ec63..c7d611e 100644 --- a/.github/workflows/test-positive.yml +++ b/.github/workflows/test-positive.yml @@ -26,6 +26,7 @@ jobs: id: current with: atmos-gitops-config-path: "./tests/atmos-gitops.yaml" + select-filter: '.settings.github.actions_enabled // false' outputs: selected-components: "${{ steps.current.outputs.selected-components }}" diff --git a/action.yml b/action.yml index 8b11946..eb2c82d 100644 --- a/action.yml +++ b/action.yml @@ -5,10 +5,10 @@ branding: icon: "file" color: "white" inputs: - jq-query: + select-filter: description: jq query that will be used to select atmos components required: false - default: 'to_entries[] | .key as $parent | .value.components.terraform | to_entries[] | select(.value.settings.github.actions_enabled // false) | [$parent, .key] | join(",")' + default: '.' head-ref: description: The head ref to checkout. If not provided, the head default branch is used. required: false @@ -81,7 +81,7 @@ runs: ATMOS_CLI_CONFIG_PATH: ${{ steps.config.outputs.atmos-config-path }} JQUERY: | with_entries(.value |= (.components.terraform)) | ## Deal with components type of terraform - map_values(map_values(select(.settings.github.actions_enabled // false))) | ## Filter components by enabled github actions + map_values(map_values(select(${{ inputs.select-filter }}))) | ## Filter components by enabled github actions map_values(select(. != {})) | ## Skip stacks that have 0 selected components map_values(. | keys) | ## Reduce to component names with_entries( ## Construct component object