-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add working-directory to the comment #17
Comments
@wolverian - sorry for the delay, and yes, excellent suggestion! I recently ran into this problem myself with comments not being deleted due to the title lookup in a matrix run, but the folder problem is also relevant. |
As inspiration, https://github.com/iStreamPlanet/github-actions/tree/main/terraform-actions does (or I should say "did", that action seems non-maintained nowadays) the equivalent with a working directory input to the action. Whichever of the suggested solutions above sound promising (and would be what I'd need in order to switch from iStreamPlanet into this action). ❤️ |
Great suggestion @MPV - name: >
Post Plan >> Env: ${{ matrix.project.env }} | Dir: ${{ matrix.project.dir }}
if: always() && github.ref != 'refs/heads/master' && (steps.plan.outcome == 'success' || steps.plan.outcome == 'failure')
uses: robburger/terraform-pr-commenter@v1
env:
TF_WORKSPACE: ${{ format('Env= {0} | Dir= {1}', matrix.project.env, matrix.project.dir) }}
with:
commenter_type: plan
commenter_input: ${{ format('{0}{1}', steps.plan.outputs.stdout, steps.plan.outputs.stderr) }}
commenter_exitcode: ${{ steps.plan.outputs.exitcode }} Which looks like this. Not great... not terrible...
|
Worth pointing out that the |
Inspiration for fixing this: I notice that https://github.com/thollander/actions-comment-pull-request uses a hidden HTML comment to distinguish between comments. That might be a pretty nice implementation. We could also simply delegate the commenting to https://github.com/thollander/actions-comment-pull-request (using a composite action) if we don't want to implement the logic ourselves. |
Thank you for the great action! We're running it in production now. 🙂
I have a feature request that would help us: we're running this action for a bunch of modules in one repo, i.e. our repo looks something like this:
We use an Actions matrix to run the same steps for each directory. This works! 🎉 However, the comment for each init/plan/apply doesn't indicate which module it came from:
This could be fixed by adding the working directory to the message, so it would be e.g.
<directory>: Terraform <action> <result> for workspace <workspace>
. Another option would be to add the directory tocommenter_input
, but I haven't tried this yet, as I've assumed that argument should contain only output from Terraform itself.Does this sound like a sensible feature? Thank you!
The text was updated successfully, but these errors were encountered: