Skip to content

Commit b1f327c

Browse files
authored
Merge pull request hashicorp#18 from hashicorp/sourceinfo
Add action and workflow names to output
2 parents e3773c2 + 40ae045 commit b1f327c

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

fmt/entrypoint.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ done
3232

3333
COMMENT="#### \`terraform fmt\` Failed
3434
$FMT_OUTPUT
35+
*Workflow: \`$GITHUB_WORKFLOW\`, Action: \`$GITHUB_ACTION\`*
3536
"
3637
PAYLOAD=$(echo '{}' | jq --arg body "$COMMENT" '.body = $body')
3738
COMMENTS_URL=$(cat /github/workflow/event.json | jq -r .pull_request.comments_url)

init/entrypoint.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ fi
2828
COMMENT="#### \`terraform init\` Failed
2929
\`\`\`
3030
$OUTPUT
31-
\`\`\`"
31+
\`\`\`
32+
*Workflow: \`$GITHUB_WORKFLOW\`, Action: \`$GITHUB_ACTION\`*"
3233
PAYLOAD=$(echo '{}' | jq --arg body "$COMMENT" '.body = $body')
3334
COMMENTS_URL=$(cat /github/workflow/event.json | jq -r .pull_request.comments_url)
3435
curl -s -S -H "Authorization: token $GITHUB_TOKEN" --header "Content-Type: application/json" --data "$PAYLOAD" "$COMMENTS_URL" > /dev/null

plan/entrypoint.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,8 @@ COMMENT=""
5353
if [ $SUCCESS -ne 0 ]; then
5454
OUTPUT=$(wrap "$OUTPUT")
5555
COMMENT="#### \`terraform plan\` Failed
56-
$OUTPUT"
56+
$OUTPUT
57+
*Workflow: \`$GITHUB_WORKFLOW\`, Action: \`$GITHUB_ACTION\`*"
5758
else
5859
# Remove "Refreshing state..." lines by only keeping output after the
5960
# delimiter (72 dashes) that represents the end of the refresh stage.
@@ -70,7 +71,8 @@ else
7071
OUTPUT=$(wrap "$OUTPUT")
7172

7273
COMMENT="#### \`terraform plan\` Success
73-
$OUTPUT"
74+
$OUTPUT
75+
*Workflow: \`$GITHUB_WORKFLOW\`, Action: \`$GITHUB_ACTION\`*"
7476
fi
7577

7678
# Post the comment.

validate/entrypoint.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ fi
2323
COMMENT="#### \`terraform validate\` Failed
2424
\`\`\`
2525
$OUTPUT
26-
\`\`\`"
26+
\`\`\`
27+
*Workflow: \`$GITHUB_WORKFLOW\`, Action: \`$GITHUB_ACTION\`*"
2728
PAYLOAD=$(echo '{}' | jq --arg body "$COMMENT" '.body = $body')
2829
COMMENTS_URL=$(cat /github/workflow/event.json | jq -r .pull_request.comments_url)
2930
curl -s -S -H "Authorization: token $GITHUB_TOKEN" --header "Content-Type: application/json" --data "$PAYLOAD" "$COMMENTS_URL" > /dev/null

0 commit comments

Comments
 (0)