Skip to main content
deploy-affected.yml1.5 KB
View on GitHub
name: Plan Affected
on:
pull_request:

jobs:
affected:
runs-on: ubuntu-latest
container:
image: ghcr.io/cloudposse/atmos:${{ vars.ATMOS_VERSION }}
outputs:
matrix: ${{ steps.affected.outputs.matrix }}
count: ${{ steps.affected.outputs.count }}
steps:
# A full clone (the default) gives describe affected the base commit.
- env:
GIT_TOKEN: ${{ secrets.GITEA_TOKEN }}
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: credential.helper
GIT_CONFIG_VALUE_0: '!f() { echo username=oauth2; echo "password=$GIT_TOKEN"; }; f'
run: atmos git clone --ci --ref "$GITHUB_SHA"

- id: affected
run: atmos describe affected --format=matrix

plan:
needs: affected
if: ${{ needs.affected.outputs.count != '0' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/cloudposse/atmos:${{ vars.ATMOS_VERSION }}
strategy:
matrix: ${{ fromJson(needs.affected.outputs.matrix) }}
fail-fast: false
steps:
- env:
GIT_TOKEN: ${{ secrets.GITEA_TOKEN }}
GIT_CONFIG_COUNT: 1
GIT_CONFIG_KEY_0: credential.helper
GIT_CONFIG_VALUE_0: '!f() { echo username=oauth2; echo "password=$GIT_TOKEN"; }; f'
run: atmos git clone --ci --ref "$GITHUB_SHA"

- env:
COMPONENT: ${{ matrix.component }}
STACK: ${{ matrix.stack }}
ATMOS_CI_GITEA_TOKEN: ${{ secrets.ATMOS_CI_GITEA_TOKEN }}
run: atmos terraform plan "$COMPONENT" -s "$STACK"