Skip to content

Commit

Permalink
try truncating output to not exeed max
Browse files Browse the repository at this point in the history
  • Loading branch information
tjololo committed Aug 27, 2024
1 parent ff6ff5f commit 13939cf
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion actions/terraform/plan/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,24 @@ runs:
name: ${{ env.ARTIFACT_KEY }}
path: ${{ inputs.working_directory }}/tfplan.out

- name: generate random delimiter
shell: bash
run: echo "DELIMITER=$(uuidgen)" >> $GITHUB_ENV
- name: truncate terraform plan result
shell: bash
run: |
plan=$(cat <<${{ env.DELIMITER }}
${{ format('{0}{1}', steps.plan.outputs.stdout, steps.plan.outputs.stderr) }}
${{ env.DELIMITER }}
)
plan=$(echo "${plan}" | grep -v 'Refreshing state' | tail --bytes 65500)
echo "${plan}"
echo "PLAN<<${{ env.DELIMITER }}2" >> $GITHUB_ENV
echo '[maybe truncated]' >> $GITHUB_ENV
echo "${plan}" >> $GITHUB_ENV
echo >> $GITHUB_ENV
echo "${{ env.DELIMITER }}2" >> $GITHUB_ENV
- name: Generate Terraform Summary
id: action_summary
uses: actions/github-script@v7
Expand Down Expand Up @@ -166,7 +184,7 @@ runs:
<details><summary>Show Plan</summary>
\`\`\`\n
${{ steps.plan.outputs.stdout }}
${{ env.PLAN }}
\`\`\`
</details>
Expand Down

0 comments on commit 13939cf

Please sign in to comment.