Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,33 @@ runs:
aws-region: ${{ inputs.aws-region }}

- name: Run CLI
# apparently getting the stdout is nigh impossible in GHA, so this action helps
uses: mathiasvr/command-output@34408ea3d0528273faff3d9e201761ae96106cd0 # ratchet:mathiasvr/command-output@v2.0.0
id: pulumi-run
with:
# can't use working-directory with this action, so specifying it in the uv command
run: uv --directory ${{ github.workspace }}/${{ inputs.project-dir }} run python -m ${{ inputs.deploy-script-module-name }}.${{ inputs.deploy-script-name }} --stack=${{ inputs.stack-name }} ${{ inputs.cli-action }}
shell: bash
run: |
output=$(uv --directory ${{ github.workspace }}/${{ inputs.project-dir }} run python -m ${{ inputs.deploy-script-module-name }}.${{ inputs.deploy-script-name }} --stack=${{ inputs.stack-name }} ${{ inputs.cli-action }})
header=":eyes: **Pulumi Preview for ${{ inputs.deploy-script-module-name }} stack ${{ inputs.stack-name }}:** :eyes:"

cat > /tmp/pulumi-preview-comment.md << EOF
$header

\`\`\`bash
$output
\`\`\`
EOF

if [ $(wc -c < /tmp/pulumi-preview-comment.md) -gt 65535 ]; then
cat > /tmp/pulumi-preview-comment.md << EOF
$header

Output was too long to display here.

[View the full output in the Actions run.](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
EOF
fi
shell: bash

- name: Comment the Preview on the Pull Request
if: ${{ inputs.show-preview-comment-on-pr == 'true' }}
# pin this sha (v3.0.1) for extra security since this action has some permissions to write to the pull request comments
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b
with:
message: |
:eyes: **Pulumi Preview for ${{ inputs.deploy-script-module-name }} stack ${{ inputs.stack-name }}:** :eyes:

```bash
${{ steps.pulumi-run.outputs.stdout }}
```
file-path: /tmp/pulumi-preview-comment.md
comment-tag: previewonpr-${{ inputs.deploy-script-module-name }}-${{ inputs.stack-name }}{% endraw %}