Skip to content

Commit

Permalink
Improve condiition
Browse files Browse the repository at this point in the history
  • Loading branch information
goruha committed Aug 19, 2024
1 parent 5a2e1d9 commit d352589
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,21 +130,21 @@ runs:
outputPath: command
- name: Set atmos cli base path vars
if: ${{ fromJson(steps.component.outputs.settings).enabled == 'true' }}
if: ${{ fromJson(steps.component.outputs.settings).enabled }}
shell: bash
run: |-
# Set ATMOS_BASE_PATH allow `cloudposse/utils` provider to read atmos config from the correct path
ATMOS_BASE_PATH="${{ fromJson(steps.component.outputs.settings).base-path }}"
echo "ATMOS_BASE_PATH=$(realpath ${ATMOS_BASE_PATH:-./})" >> $GITHUB_ENV
- name: Prepare Artifacts Directory
if: ${{ fromJson(steps.component.outputs.settings).enabled == 'true' }}
if: ${{ fromJson(steps.component.outputs.settings).enabled }}
shell: bash
run: |
mkdir -p metadata
- name: Define Job Variables
if: ${{ fromJson(steps.component.outputs.settings).enabled == 'true' }}
if: ${{ fromJson(steps.component.outputs.settings).enabled }}
id: vars
shell: bash
run: |
Expand Down Expand Up @@ -173,7 +173,7 @@ runs:
echo "issue_file=${ISSUE_SUMMARY_FILE}" >> $GITHUB_OUTPUT
- name: Configure Plan AWS Credentials
if: ${{ fromJson(steps.component.outputs.settings).enabled == 'true' }}
if: ${{ fromJson(steps.component.outputs.settings).enabled }}
uses: aws-actions/[email protected]
with:
aws-region: ${{ steps.config.outputs.aws-region }}
Expand All @@ -184,14 +184,14 @@ runs:
- name: Cache .terraform
id: cache
uses: actions/cache@v4
if: ${{ fromJson(steps.component.outputs.settings).enabled == 'true' }}
if: ${{ fromJson(steps.component.outputs.settings).enabled }}
with:
path: |
./${{ steps.vars.outputs.component_path }}/.terraform
key: ${{ steps.vars.outputs.cache-key }}

- name: Atmos Terraform Plan
if: ${{ fromJson(steps.component.outputs.settings).enabled == 'true' }}
if: ${{ fromJson(steps.component.outputs.settings).enabled }}
id: atmos-plan
shell: bash
run: |
Expand Down Expand Up @@ -358,7 +358,7 @@ runs:
sed -i -e '/%INFRACOST_DIFF%/{r /tmp/infracost.txt' -e 'd}' ${{ steps.vars.outputs.step_summary_file }}
- name: Store Component Metadata to Artifacts
if: ${{ fromJson(steps.component.outputs.settings).enabled == 'true' && inputs.drift-detection-mode-enabled == 'true' }}
if: ${{ fromJson(steps.component.outputs.settings).enabled && inputs.drift-detection-mode-enabled == 'true' }}
shell: bash
run: |
echo -n '{ "stack": "${{ inputs.stack }}", "component": "${{ inputs.component }}", "componentPath": "${{ steps.vars.outputs.component_path }}", "drifted": '"${{ steps.atmos-plan.outputs.changes }}"', "error": '"${{ steps.atmos-plan.outputs.error }}"' }' > "metadata/${{ steps.vars.outputs.component_slug }}.metadata.json"
Expand Down Expand Up @@ -402,7 +402,7 @@ runs:
echo "rand=$(openssl rand -hex 5)" >> "$GITHUB_OUTPUT"
- name: Upload Artifacts
if: ${{ fromJson(steps.component.outputs.settings).enabled == 'true' && inputs.drift-detection-mode-enabled == 'true' }}
if: ${{ fromJson(steps.component.outputs.settings).enabled && inputs.drift-detection-mode-enabled == 'true' }}
uses: actions/upload-artifact@v4
with:
# The name of the artifact needs to be unique for every job run!
Expand All @@ -412,7 +412,7 @@ runs:
retention-days: ${{ inputs.metadata-retention-days }}

- name: Exit status
if: ${{ fromJson(steps.component.outputs.settings).enabled == 'true' }}
if: ${{ fromJson(steps.component.outputs.settings).enabled }}
shell: bash
run: |
exit ${{ steps.atmos-plan.outputs.result }}

0 comments on commit d352589

Please sign in to comment.