Skip to content

Commit 9a3c7db

Browse files
gsavageclaude
andcommitted
Capture apply output as artifact and step summary
The apply step previously only emitted to STDOUT, visible on the GitHub run page but not retrievable afterwards. Tee its output to a file, upload it as the tfapply-<environment> artifact, and append the "Apply complete!" line to the step summary — mirroring the existing plan capture. All three new steps are gated on tf_apply == 'true' so the plan-only workflow is unaffected. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 900ff87 commit 9a3c7db

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

.github/workflows/base.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,19 @@ jobs:
8585
- name: Apply
8686
if: inputs.tf_apply == 'true'
8787
working-directory: ${{ inputs.working_directory }}
88-
run: tf apply
88+
run: tf apply 2>&1 | tee /tmp/${{ inputs.environment }}.apply.txt
89+
90+
- name: Apply summary
91+
if: inputs.tf_apply == 'true'
92+
run: |
93+
line=$(grep -E 'Apply complete!' /tmp/${{ inputs.environment }}.apply.txt)
94+
echo "### ${{ inputs.environment }} (apply)" >> $GITHUB_STEP_SUMMARY
95+
echo "$line" >> $GITHUB_STEP_SUMMARY
96+
97+
- name: Upload apply log
98+
if: inputs.tf_apply == 'true'
99+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
100+
with:
101+
name: tfapply-${{ inputs.environment }}
102+
path: /tmp/${{ inputs.environment }}.apply.txt
103+
archive: false

0 commit comments

Comments
 (0)