Skip to content

Commit

Permalink
update plan
Browse files Browse the repository at this point in the history
  • Loading branch information
liyangau committed Apr 19, 2024
1 parent 9c9e57f commit 7d520ed
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions .github/workflows/plan.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,15 @@ jobs:
run: terraform validate -no-color
- name: Terraform Plan
id: plan
run: terraform plan -no-color
run: |
plan_output=$(terraform plan -no-color)
echo "::set-output name=plan::${plan_output}"
echo "${plan_output}" > plan.txt
- name: Upload Terraform Plan out as artifact
uses: actions/upload-artifact@v4
with:
name: plan
path: ./plan.txt
continue-on-error: true
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
Expand All @@ -71,12 +79,13 @@ jobs:
TF_VAR_cp_region: "au"
TF_VAR_exclude_mesh_control_plane: true
- uses: actions/github-script@v6
# env:
# PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
env:
PLAN: "terraform\n${{ steps.plan.outputs.stdout }}"
if: github.event_name == 'pull_request'
with:
github-token: ${{ secrets.GH_TOKEN }}
script: |
const planOutput = fs.readFileSync('${{ github.workspace }}/plan.txt', 'utf8');
// 1. Retrieve existing bot comments for the PR
const { data: comments } = await github.rest.issues.listComments({
owner: context.repo.owner,
Expand All @@ -96,7 +105,7 @@ jobs:
<details><summary>Show Plan</summary>
\`\`\`\n
${{ steps.plan.outputs.stdout }}
planOutput
\`\`\`
</details>
Expand Down Expand Up @@ -131,4 +140,4 @@ jobs:
# ...context.repo,
# issue_number: context.issue.number,
# body: "### Terraform Plan Output\n" + "```\n" + planOutput + "\n```"
# });
# });

0 comments on commit 7d520ed

Please sign in to comment.