Skip to content

Commit

Permalink
Incupsulate configs
Browse files Browse the repository at this point in the history
  • Loading branch information
goruha committed Dec 7, 2023
1 parent 7f36807 commit 97736d0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-matrix-2-levels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-matrix-3-levels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-positive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 97736d0

Please sign in to comment.