diff --git a/action.yml b/action.yml index 2eac6fc..a84e46d 100644 --- a/action.yml +++ b/action.yml @@ -11,6 +11,10 @@ inputs: description: "The version of Terramate to use" required: false default: "latest" + terramate-cloud-organization: + required: false + description: Terramate Cloud organization to use by default when using Terramate Cloud features. + default: "" terraform-version: description: "The version of Terraform to use" required: false @@ -115,16 +119,11 @@ inputs: runs: using: "composite" steps: - - name: Setup Go + - uses: terramate-io/terramate-action@v2 if: ${{ inputs.setup == 'true' }} - uses: actions/setup-go@v5 with: - cache: false - - name: Setup Terramate - if: ${{ inputs.setup == 'true' }} - run: | - go install github.com/terramate-io/terramate/cmd/...@${{ inputs.terramate-version }} - shell: bash + version: ${{ inputs.terramate-version }} + cloud_organization: ${{ inputs.terramate-cloud-organization }} - name: Setup Terraform if: ${{ inputs.setup == 'true' }} uses: hashicorp/setup-terraform@v3 @@ -168,11 +167,11 @@ runs: shell: bash - name: Plan if: >- - ${{ + ${{ ( inputs.plan == 'true' || - ( inputs.comment-pull-request == 'true' && + ( inputs.comment-pull-request == 'true' && github.event_name == 'pull_request' ) - ) && + ) && steps.list.outputs.stdout != '' }} run: | terramate run \ @@ -185,8 +184,8 @@ runs: shell: bash - name: Generate Preview Comment if: >- - ${{ - inputs.comment-pull-request == 'true' && + ${{ + inputs.comment-pull-request == 'true' && github.event_name == 'pull_request' }} run: | @@ -217,8 +216,8 @@ runs: shell: bash - name: Publish Plans if: >- - ${{ - inputs.comment-pull-request == 'true' && + ${{ + inputs.comment-pull-request == 'true' && github.event_name == 'pull_request' }} uses: marocchino/sticky-pull-request-comment@v2 @@ -228,14 +227,14 @@ runs: path: ${{ inputs.temp-file }} - name: Apply if: >- - ${{ - inputs.apply == 'true' && + ${{ + inputs.apply == 'true' && steps.list.outputs.stdout != '' }} run: | if [ -f "${{ inputs.terraform-plan-file }}" ]; then terramate run \ - ${{ inputs.terramate-args }} \ + ${{ inputs.terramate-args }} \ ${{ inputs.terramate-apply-args }} \ -- terraform apply \ -auto-approve \ @@ -256,9 +255,9 @@ runs: shell: bash - name: Destroy if: >- - ${{ - inputs.destroy == 'true' && - steps.list.outputs.stdout != '' + ${{ + inputs.destroy == 'true' && + steps.list.outputs.stdout != '' }} run: | terramate run \