Skip to content
This repository was archived by the owner on Mar 17, 2025. It is now read-only.
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
9 changes: 0 additions & 9 deletions .changesets/20250311T213924-pr-6.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changesets/20250311T220611-pr-9.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changesets/20250311T222101-pr-10.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changesets/20250312T015433-pr-12.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changesets/20250312T020357-pr-13.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changesets/20250312T021357-pr-14.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changesets/20250312T023011-pr-15.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changesets/20250312T161422-pr-20.md

This file was deleted.

9 changes: 0 additions & 9 deletions .changesets/20250312T162551-pr-22.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: "feat: add new emoji"
pr: 16
title: "feat: lightning emoji"
pr: 23
author: "jasonbahl"
type: "feat"
breaking: false
Expand Down
31 changes: 0 additions & 31 deletions .github/workflows/create-tag.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/generate-changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
contents: write
pull-requests: write
needs: [debug-event]
if: (github.event_name == 'pull_request_target' && github.event.pull_request.merged == true) || github.event_name == 'workflow_dispatch'
if: (github.event_name == 'pull_request_target' && github.event.pull_request.merged == true && github.event.pull_request.base.ref != 'main') || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
env:
REPO_URL: "https://github.com/${{ github.repository }}"
Expand Down
69 changes: 51 additions & 18 deletions .github/workflows/release-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,23 @@ jobs:
- name: Generate release notes
id: release_notes
run: |
# Extract changelog content for the current version
CHANGELOG_CONTENT=$(awk '/^## \['"${{ steps.version_bump.outputs.version }}"'\]/{flag=1; next} /^## \[/{flag=0} flag' CHANGELOG.md)
# Generate release notes directly using our script
npm run release:notes > release_notes.md

# Escape newlines for GitHub Actions
CHANGELOG_CONTENT="${CHANGELOG_CONTENT//'%'/'%25'}"
CHANGELOG_CONTENT="${CHANGELOG_CONTENT//$'\n'/'%0A'}"
CHANGELOG_CONTENT="${CHANGELOG_CONTENT//$'\r'/'%0D'}"
# For debugging
echo "Generated release notes:"
cat release_notes.md

echo "content=${CHANGELOG_CONTENT}" >> $GITHUB_OUTPUT
# Set the content for GitHub Actions output
# Properly escape the content for GitHub Actions
RELEASE_NOTES=$(cat release_notes.md)
RELEASE_NOTES="${RELEASE_NOTES//'%'/'%25'}"
RELEASE_NOTES="${RELEASE_NOTES//$'\n'/'%0A'}"
RELEASE_NOTES="${RELEASE_NOTES//$'\r'/'%0D'}"

echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$RELEASE_NOTES" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT

- name: Commit changes
if: github.event_name != 'pull_request_target'
Expand All @@ -126,11 +134,16 @@ jobs:
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"

# Create an annotated tag with the changelog as the message
git tag -a "v${{ steps.version_bump.outputs.version }}" -m "Release v${{ steps.version_bump.outputs.version }}"

# Push the tag
git push origin "v${{ steps.version_bump.outputs.version }}"
# Check if tag already exists
if git rev-parse "v${{ steps.version_bump.outputs.version }}" >/dev/null 2>&1; then
echo "Tag v${{ steps.version_bump.outputs.version }} already exists. Skipping tag creation."
else
# Create an annotated tag with the changelog as the message
git tag -a "v${{ steps.version_bump.outputs.version }}" -m "Release v${{ steps.version_bump.outputs.version }}"

# Push the tag
git push origin "v${{ steps.version_bump.outputs.version }}"
fi

- name: Create GitHub Release
if: github.event_name == 'pull_request_target'
Expand All @@ -147,11 +160,31 @@ jobs:
- name: Archive changesets
if: github.event_name == 'pull_request_target'
run: |
# Move all changesets to the archive directory
# Create archive directory if it doesn't exist
mkdir -p .changesets/archive
find .changesets -maxdepth 1 -name "*.md" -type f -exec mv {} .changesets/archive/ \;

# Commit the archived changesets
git add .changesets/archive
git commit -m "chore: archive changesets for v${{ steps.version_bump.outputs.version }}"
git push origin main
# Configure Git
git config --global user.name "GitHub Actions"
git config --global user.email "actions@github.com"

# Check if there are any changesets to archive
if [ -n "$(find .changesets -maxdepth 1 -name "*.md" -type f)" ]; then
# List all changesets before moving
echo "Changesets to archive:"
find .changesets -maxdepth 1 -name "*.md" -type f -exec basename {} \;

# Move each changeset individually and add to Git
for file in $(find .changesets -maxdepth 1 -name "*.md" -type f); do
filename=$(basename "$file")
echo "Moving $filename to archive"
git mv "$file" ".changesets/archive/$filename"
done

# Commit the archived changesets
git commit -m "chore: archive changesets for v${{ steps.version_bump.outputs.version }}"
git push origin main

echo "Archived changesets for v${{ steps.version_bump.outputs.version }}"
else
echo "No changesets found to archive"
fi
2 changes: 1 addition & 1 deletion automation-tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

// show a message in the admin dashboard with the plugin name and version
add_action( 'admin_notices', function() {
echo '<div class="notice notice-info"><p> Automation Tests v' . AUTOMATION_TESTS_VERSION . '</p></div>';
echo '<div class="notice notice-info"><p> Automation Tests v' . AUTOMATION_TESTS_VERSION . '</p></div>';
});


Expand Down
16 changes: 12 additions & 4 deletions scripts/generate-release-notes.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,21 @@ function readChangesets() {
const changesetDir = path.join(process.cwd(), '.changesets');

if (!fs.existsSync(changesetDir)) {
console.error('No .changesets directory found.');
console.log('No .changesets directory found. Creating one...');
fs.mkdirSync(changesetDir, { recursive: true });
return [];
}

// Only read changesets from the main directory, not from the archive
const changesetFiles = glob.sync('*.md', { cwd: changesetDir });

if (changesetFiles.length === 0) {
console.log('No changesets found.');
return [];
}

console.log(`Found ${changesetFiles.length} changesets.`);

return changesetFiles.map(file => {
const content = fs.readFileSync(path.join(changesetDir, file), 'utf8');
const frontMatter = content.match(/---\n([\s\S]*?)\n---/);
Expand All @@ -76,9 +80,7 @@ function readChangesets() {
try {
// Parse the YAML-like front matter
const lines = frontMatter[1].split('\n');
const changeset = {
file
};
const changeset = {};

lines.forEach(line => {
if (line.trim() === '' || line.startsWith('description:')) return;
Expand All @@ -90,6 +92,12 @@ function readChangesets() {
changeset[key.trim()] = value.replace(/^"(.*)"$/, '$1');
});

// Extract description
const descriptionMatch = content.match(/description: \|\n([\s\S]*?)(\n---|\n$)/);
if (descriptionMatch) {
changeset.description = descriptionMatch[1].trim();
}

return changeset;
} catch (err) {
console.warn(`Error parsing changeset ${file}:`, err);
Expand Down
Loading