robburger / terraform-pr-commenter

A GitHub Action that adds opinionated comments to a PR from Terraform fmt/init/plan output
MIT License
129 stars 63 forks source link

Action does not work with Composite action #24

Closed marcellovictorino closed 2 years ago

marcellovictorino commented 2 years ago

Once again, thanks for this great Action!

Since the steps are repetitive, quite verbose and with clear parameters, I wanted to encapsulate it within a GitHub composite action.

I managed to work around its current limitations -i.e. not supporting the continue-on-error functionality. But the action just did not post a comment. Not even mentioned: "this is not a PR..."

@robburger ❓ Am I missing something? I would love to use this "composite" version in my workflows.


.github/actions/terraform_comment_pr/actions.yml


name: 'Terraform Comment PR'
description: 'Init, Plan and Apply TF projects, commenting Plan output onto PR'
inputs:
deploymentDirectory:  # id of input
description: 'the directory of the terraform project'
required: true
env:  # id of input
description: 'the deployment environment'
required: true
workspaceEnv:  # id of input
description: 'the deployment WORKSPACE environment to be activated'
required: true

runs: using: "composite" steps:

And the actual workflow would look like this:

- name: Terraform Comment PR
  uses: ./.github/actions/terraform_comment_pr
  with:
    deploymentDirectory: ${{ matrix.project.dir }}
    env:  ${{ matrix.project.env }}
    workspaceEnv: ${{ env.ENV }} 
marcellovictorino commented 2 years ago

That was my mistake! The if condition around the POST PLAN step is not properly supported. So there is no issue with the action itself 👍