Skip to content
Open
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
15 changes: 5 additions & 10 deletions .github/workflows/release-notes-linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,13 @@ jobs:
# Validate PR release notes
echo "Going to validate PR ${PR_NUMBER}"

echo "First making sure you have not left the PR template as is"
# Describe any user facing changes here, or delete this block.
TEMPLATE_LEFT_AS_IS=$(wget -q -O- https://api.github.com/repos/shipwright-io/cli/pulls/${PR_NUMBER} | jq '.body | match("(Describe any user facing changes here, or delete this block)")')
if [ -z "${TEMPLATE_LEFT_AS_IS}" ]; then
echo "You appear to have attempted to update the PR template to define a release note."
else
echo "You have not made any changes for release notes in your PR description. Edit your PR description per the instructions at https://raw.githubusercontent.com/shipwright-io/cli/main/.github/pull_request_template.md"
exit 1
fi
PR_BODY=$(wget -q -O- https://api.github.com/repos/shipwright-io/cli/pulls/${PR_NUMBER} | jq '.body')

echo "Now checking against valid structure for release notes"
MATCHES=$(wget -q -O- https://api.github.com/repos/shipwright-io/cli/pulls/${PR_NUMBER} | jq '.body | match("(```release-note\r\n(.*|NONE|action required: .*)\r\n```)")')
# Strip CR so the match works for both CRLF (web UI) and LF (API, gh CLI) bodies.
# The block must contain at least one non-blank line and may span multiple lines
# (e.g. "action required" followed by a bullet list).
MATCHES=$(echo "${PR_BODY}" | jq 'gsub("\r"; "") | match("```release-note\n(.*[^[:space:]].*\n(?:.*\n)*?)```")')
if [ -z "${MATCHES}" ]; then
echo "Your Release Notes were not properly defined or they are not in place, please make sure you add them."
echo "See our PR template for more information: https://raw.githubusercontent.com/shipwright-io/cli/main/.github/pull_request_template.md"
Expand Down
Loading