Skip to content
Merged
Show file tree
Hide file tree
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
59 changes: 35 additions & 24 deletions .github/workflows/generate-changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,22 +175,29 @@ jobs:

PR_TITLE=$(echo "$PR_DATA" | jq -r '.title')

# Create the PR body with proper formatting
PR_BODY="## Upcoming Changes"
PR_BODY="${PR_BODY}"$'\n\n'
PR_BODY="${PR_BODY}$(cat /tmp/release-notes/temp_notes.md)"

# Add @since updates section if there are any
# Create the PR body using heredoc to preserve special characters
cat > /tmp/pr_body.md << 'EOL'
## Upcoming Changes

$(cat /tmp/release-notes/temp_notes.md)
EOL

# Add @since updates section if there are any, using printf to handle special characters
if [[ "${{ steps.check_since.outputs.has_updates }}" == "true" ]]; then
PR_BODY="${PR_BODY}"$'\n\n'
PR_BODY="${PR_BODY}${{ steps.check_since.outputs.summary }}"
printf "\n\n%s\n" "${{ steps.check_since.outputs.summary }}" >> /tmp/pr_body.md
fi

PR_BODY="${PR_BODY}"$'\n\n'
PR_BODY="${PR_BODY}This PR contains all changes that will be included in the next release. It is automatically updated when new changesets are added to the develop branch."
# Add the footer
echo -e "\nThis PR contains all changes that will be included in the next release. It is automatically updated when new changesets are added to the develop branch." >> /tmp/pr_body.md

# Use jq to properly escape the content
PAYLOAD=$(jq -n --arg body "$PR_BODY" --arg title "$PR_TITLE" '{body: $body, title: $title}')
# Read the complete PR body and escape it for JSON
PR_BODY=$(cat /tmp/pr_body.md)

# Use jq to properly escape the content for JSON
PAYLOAD=$(jq -n \
--arg body "$PR_BODY" \
--arg title "$PR_TITLE" \
'{body: $arg.body, title: $arg.title}')

# For debugging
echo "API Payload:"
Expand All @@ -213,27 +220,31 @@ jobs:
- name: Create new release PR
if: steps.check_pr.outputs.exists == 'false'
run: |
# Create the PR body with proper formatting
PR_BODY="## Upcoming Changes"
PR_BODY="${PR_BODY}"$'\n\n'
PR_BODY="${PR_BODY}$(cat /tmp/release-notes/temp_notes.md)"

# Add @since updates section if there are any
# Create the PR body using heredoc to preserve special characters
cat > /tmp/pr_body.md << 'EOL'
## Upcoming Changes

$(cat /tmp/release-notes/temp_notes.md)
EOL

# Add @since updates section if there are any, using printf to handle special characters
if [[ "${{ steps.check_since.outputs.has_updates }}" == "true" ]]; then
PR_BODY="${PR_BODY}"$'\n\n'
PR_BODY="${PR_BODY}${{ steps.check_since.outputs.summary }}"
printf "\n\n%s\n" "${{ steps.check_since.outputs.summary }}" >> /tmp/pr_body.md
fi

PR_BODY="${PR_BODY}"$'\n\n'
PR_BODY="${PR_BODY}This PR contains all changes that will be included in the next release. It is automatically updated when new changesets are added to the develop branch."
# Add the footer
echo -e "\nThis PR contains all changes that will be included in the next release. It is automatically updated when new changesets are added to the develop branch." >> /tmp/pr_body.md

# Read the complete PR body and escape it for JSON
PR_BODY=$(cat /tmp/pr_body.md)

# Use jq to properly escape the content
# Use jq to properly escape the content for JSON
PAYLOAD=$(jq -n \
--arg title "release: next version 📦" \
--arg head "develop" \
--arg base "main" \
--arg body "$PR_BODY" \
'{title: $title, head: $head, base: $base, body: $body}')
'{title: $arg.title, head: $arg.head, base: $arg.base, body: $arg.body}')

# For debugging
echo "API Payload:"
Expand Down
3 changes: 3 additions & 0 deletions automation-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
* Author: Jason Bahl
*/

/**
* Added a missing docblock in @next-version
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
Expand Down
Loading