Skip to content

Commit c55592f

Browse files
fix: update the action
1 parent 018f1ac commit c55592f

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

  • .github/actions/auto-release-description

.github/actions/auto-release-description/action.yml

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,40 @@ runs:
6868
JIRA_TICKET_URL_PREFIX: ${{ inputs.jira-ticket-url-prefix }}
6969
run: |
7070
# Generate description using AI (with chunking support for large diffs)
71-
node ${{ github.action_path }}/generate_pr_description.js pr.diff > release_description.md
71+
# The script writes description to stdout, errors to stderr
72+
if ! node ${{ github.action_path }}/generate_pr_description.js pr.diff > release_description.md 2>generate_errors.log; then
73+
echo "Error: Failed to generate release description" >&2
74+
cat generate_errors.log >&2
75+
exit 1
76+
fi
7277
7378
# Get existing PR body to preserve all content
74-
gh pr view ${{ inputs.pr-number }} --json body --jq '.body' > pr_body.md
79+
gh pr view ${{ inputs.pr-number }} --json body --jq '.body' > pr_body.md || {
80+
echo "Error: Failed to get PR body" >&2
81+
exit 1
82+
}
7583
7684
# Insert the generated description into the existing PR body
7785
# This preserves all existing content and uses comment tags for auto-generated section
78-
node ${{ github.action_path }}/insert_release_description.js pr_body.md release_description.md > new_body.md
86+
node ${{ github.action_path }}/insert_release_description.js pr_body.md release_description.md > new_body.md || {
87+
echo "Error: Failed to insert release description" >&2
88+
exit 1
89+
}
7990
8091
# Output the description for other steps to use
81-
echo "description<<EOF" >> $GITHUB_OUTPUT
82-
cat release_description.md >> $GITHUB_OUTPUT
83-
echo "EOF" >> $GITHUB_OUTPUT
92+
# Use a unique delimiter to avoid conflicts with content that might contain "EOF"
93+
DELIMITER="GITHUB_OUTPUT_DESCRIPTION_$(date +%s)_$$"
94+
{
95+
echo "description<<${DELIMITER}"
96+
# Ensure file exists and is readable
97+
if [ -f release_description.md ] && [ -s release_description.md ]; then
98+
cat release_description.md
99+
else
100+
echo "Error: release_description.md is missing or empty" >&2
101+
echo "Error: release_description.md is missing or empty"
102+
fi
103+
echo "${DELIMITER}"
104+
} >> $GITHUB_OUTPUT
84105
85106
- name: Update PR description
86107
id: update_pr

0 commit comments

Comments
 (0)