-
-
Notifications
You must be signed in to change notification settings - Fork 46
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
Output to file and comment at the same time. #1412
Comments
Thank you for your feedback. The workaround is to output the result to a text file. #!/usr/bin/env bash
set -u
tfcmt plan -- terraform plan 2>&1 | tee result.txt
code=${PIPESTATUS[0]}
tfcmt --output plan.md plan -- bash -c "cat result.txt && exit "$code"" |
that assumes |
we are running currently like this: tfcmt \
--config ${{ github.action_path }}/config/summary.yaml \
-owner "${{ github.repository_owner }}" \
-repo "${{ github.event.repository.name }}" \
-var "target:${{ steps.vars.outputs.component_slug }}" \
-var "component:${{ inputs.component }}" \
-var "componentPath:${{ steps.vars.outputs.component_path }}" \
-var "commitSHA:${{ inputs.sha }}" \
-var "stack:${{ inputs.stack }}" \
-var "job:${{ github.job }}" \
-var "logoImage:${{ inputs.branding-logo-image }}" \
-var "logoUrl:${{ inputs.branding-logo-url }}" \
-var "infracost_enabled:${{ steps.config.outputs.enable-infracost }}" \
-var "driftModeEnabled:${{ inputs.drift-detection-mode-enabled }}" \
--output ${{ steps.vars.outputs.summary_file }} \
--log-level $([[ "${{ inputs.debug }}" == "true" ]] && echo "DEBUG" || echo "INFO") \
plan -- \
atmos terraform plan ${{ inputs.component }} \
--stack ${{ inputs.stack }} \
-out="${{ steps.vars.outputs.plan_file }}" \
-lock=false \
-input=false \
-no-color \
&> ${TERRAFORM_OUTPUT_FILE} then I added :
but no comment is made The summary shows up just fine, so the output of the plan is not empty |
I figured it out, and it does work, but it would be much better if this could be implemented. |
It seems that the -patch option does not work when this is set this way, it keeps adding new comments. |
🤔 It's weird. Could you create an issue for this? |
To be honest, implementing an option, would be soooooo much nicer. look how this look here: |
Feature Overview
We use the output to file and then pass it to the summary output and other steps happening later, but we need to comment on the PR simultaneously, but since `--output ${{ steps.vars.outputs.summary_file }} disables the PR comment. We had to run the plan twice, which is sometimes really slow.
It would be nice to be able to output to the file and comment to the PR at the same time or even pipe in the plan from a file to then comment on the PR ( although not as nice and requires two command)
reference https://github.com/cloudposse/github-action-atmos-terraform-plan/blob/main/action.yml#L201 ( this one only outputs to file, so I had to duplicate the step to comment to the PR)
Why is the feature needed?
to comment to the PR and output to a file for further processing
note
nothing
The text was updated successfully, but these errors were encountered: