Skip to content

Commit ef46f0c

Browse files
ci: fix action that comments on Release PRs (#6663)
Fixes issues with the action that comments updates on merged release PRs: 1. Multi-line LINKS_VALUE: Use '%s\n%s' command substitution instead of literal newline 2. Heredoc delimiter: Changed to COMMENT_BODY_END_MARKER without quotes 3. Variable bug: Fixed incorrect variable (`$URL` not `$URL_TEMPLATE`) 4. Change from `printf` to `echo` (avoid weird printf gymnastics) ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6663-ci-fix-action-that-comments-on-Release-PRs-2a96d73d365081b1b0c5c8e66f0e317f) by [Unito](https://www.unito.io)
1 parent 02d303c commit ef46f0c

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

.github/actions/comment-release-links/action.yaml

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ runs:
2828
REPO="${{ github.repository }}"
2929
3030
if [[ -z "$VERSION_FILE" ]]; then
31-
echo '::error::version_file input is required' >&2
31+
echo "::error::version_file input is required" >&2
3232
exit 1
3333
fi
3434
@@ -55,7 +55,9 @@ runs:
5555
5656
case "$VERSION_FILE" in
5757
package.json)
58-
LINKS_VALUE=$'PyPI|https://pypi.org/project/comfyui-frontend-package/{{version}}/\n''npm types|https://npm.im/@comfyorg/comfyui-frontend-types@{{version}}'
58+
LINKS_VALUE=$(printf '%s\n%s' \
59+
'PyPI|https://pypi.org/project/comfyui-frontend-package/{{version}}/' \
60+
'npm types|https://npm.im/@comfyorg/comfyui-frontend-types@{{version}}')
5961
;;
6062
apps/desktop-ui/package.json)
6163
MARKER='desktop-release-summary'
@@ -69,12 +71,13 @@ runs:
6971
COMMENT_FILE=$(mktemp)
7072
7173
{
72-
printf '<!--%s:%s%s-->\n' "$MARKER" "$DIFF_PREFIX" "$NEW_VERSION"
73-
printf '%s\n\n' "$MESSAGE"
74-
printf -- '- %s: [%s%s...%s%s](%s)\n' "$DIFF_LABEL" "$DIFF_PREFIX" "$PREV_VERSION" "$DIFF_PREFIX" "$NEW_VERSION" "$DIFF_URL"
74+
echo "<!--$MARKER:$DIFF_PREFIX$NEW_VERSION-->"
75+
echo "$MESSAGE"
76+
echo ""
77+
echo "- $DIFF_LABEL: [$DIFF_PREFIX$PREV_VERSION...$DIFF_PREFIX$NEW_VERSION]($DIFF_URL)"
7578
7679
while IFS= read -r RAW_LINE; do
77-
LINE=$(printf '%s' "$RAW_LINE" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
80+
LINE=$(echo "$RAW_LINE" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')
7881
[[ -z "$LINE" ]] && continue
7982
if [[ "$LINE" != *"|"* ]]; then
8083
echo "::warning::Skipping malformed link entry: $LINE" >&2
@@ -84,16 +87,16 @@ runs:
8487
URL_TEMPLATE=${LINE#*|}
8588
URL=${URL_TEMPLATE//\{\{version\}\}/$NEW_VERSION}
8689
URL=${URL//\{\{prev_version\}\}/$PREV_VERSION}
87-
printf -- '- %s: %s\n' "$LABEL" "$URL"
90+
echo "- $LABEL: $URL"
8891
done <<< "$LINKS_VALUE"
8992
90-
printf '\n'
93+
echo ""
9194
} > "$COMMENT_FILE"
9295
9396
{
94-
echo "body<<'EOF'"
97+
echo "body<<COMMENT_BODY_END_MARKER"
9598
cat "$COMMENT_FILE"
96-
echo 'EOF'
99+
echo "COMMENT_BODY_END_MARKER"
97100
} >> "$GITHUB_OUTPUT"
98101
echo "prev_version=$PREV_VERSION" >> "$GITHUB_OUTPUT"
99102
echo "marker_search=<!--$MARKER:" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)