Skip to content

Commit 05ce08a

Browse files
julianknutsenclaude
andcommitted
fix: avoid expression expansion issues in deploy-notify workflow
Pass multiline outputs via env vars instead of inline expressions to prevent YAML/shell escaping problems. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c5be69d commit 05ce08a

1 file changed

Lines changed: 12 additions & 11 deletions

File tree

.github/workflows/deploy-notify.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,25 +16,22 @@ jobs:
1616
- name: Build commit summary
1717
id: info
1818
run: |
19-
# Compare against the previous production tip (before this push)
2019
BEFORE="${{ github.event.before }}"
2120
HEAD="${{ github.sha }}"
2221
SHORT_HEAD="$(git rev-parse --short HEAD)"
2322
2423
if [ "$BEFORE" = "0000000000000000000000000000000000000000" ]; then
25-
# First push to production — just show the HEAD commit
26-
LOG="$(git log -1 --pretty='• \`%h\` %s (%an)')"
24+
LOG="$(git log -1 --pretty='%h %s (%an)')"
2725
COUNT=1
2826
else
2927
COUNT="$(git rev-list --count "${BEFORE}..${HEAD}")"
30-
LOG="$(git log --pretty='• \`%h\` %s (%an)' "${BEFORE}..${HEAD}" | head -15)"
28+
LOG="$(git log --pretty='%h %s (%an)' "${BEFORE}..${HEAD}" | head -15)"
3129
if [ "$COUNT" -gt 15 ]; then
3230
LOG="${LOG}
33-
and $((COUNT - 15)) more"
31+
...and $((COUNT - 15)) more"
3432
fi
3533
fi
3634
37-
# Write multiline output
3835
{
3936
echo "log<<DELIM"
4037
echo "$LOG"
@@ -46,20 +43,24 @@ jobs:
4643
- name: Notify Discord
4744
env:
4845
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL }}
46+
DEPLOY_LOG: ${{ steps.info.outputs.log }}
47+
COMMIT_COUNT: ${{ steps.info.outputs.count }}
48+
SHORT_SHA: ${{ steps.info.outputs.short_sha }}
49+
COMPARE_URL: https://github.com/${{ github.repository }}/compare/${{ github.event.before }}...${{ github.sha }}
4950
run: |
5051
jq -n \
5152
--arg title "Wasteland deployed to production" \
52-
--arg desc "${{ steps.info.outputs.log }}" \
53-
--arg count "${{ steps.info.outputs.count }} commit(s)" \
54-
--arg sha "${{ steps.info.outputs.short_sha }}" \
55-
--arg url "https://github.com/${{ github.repository }}/compare/${{ github.event.before }}...${{ github.sha }}" \
53+
--arg desc "$DEPLOY_LOG" \
54+
--arg count "$COMMIT_COUNT commit(s)" \
55+
--arg sha "$SHORT_SHA" \
56+
--arg url "$COMPARE_URL" \
5657
'{embeds: [{
5758
title: $title,
5859
description: $desc,
5960
color: 5025616,
6061
fields: [
6162
{name: "Commits", value: $count, inline: true},
62-
{name: "Head", value: ("`" + $sha + "`"), inline: true}
63+
{name: "Head", value: $sha, inline: true}
6364
],
6465
url: $url
6566
}]}' | curl -fsSL -H "Content-Type: application/json" -d @- "$DISCORD_WEBHOOK"

0 commit comments

Comments
 (0)