diff --git a/.github/workflows/integrate-develop.yml b/.github/workflows/integrate-develop.yml index 03c1742..2837821 100644 --- a/.github/workflows/integrate-develop.yml +++ b/.github/workflows/integrate-develop.yml @@ -13,6 +13,8 @@ jobs: create-or-update-pr: name: Create or Update PR to Staging runs-on: ubuntu-latest + # Skip if this is a sync commit from main + if: "!contains(github.event.head_commit.message, 'chore: sync version updates from main')" permissions: contents: write pull-requests: write @@ -128,8 +130,25 @@ jobs: # Get current PR body CURRENT_BODY=$(gh pr view $PR_NUMBER --json body --jq '.body') - # Create updated section - UPDATED_SECTION="### 🔄 Last Updated: ${TIMESTAMP}\nNew commits: ${COMMIT_COUNT}\n\n### 📝 Recent Commits\n${COMMITS}" + # Create updated section with escaped content + cat > updated-section.md << 'EOF' +### 🔄 Last Updated: TIMESTAMP_PLACEHOLDER +New commits: COUNT_PLACEHOLDER + +### 📝 Recent Commits +COMMITS_PLACEHOLDER +EOF + + # Replace placeholders safely + sed -i "s/TIMESTAMP_PLACEHOLDER/${TIMESTAMP}/g" updated-section.md + sed -i "s/COUNT_PLACEHOLDER/${COMMIT_COUNT}/g" updated-section.md + + # Process commits separately and safely + echo "${COMMITS}" | sed 's/%0A/\n/g' | sed 's/%0D//g' | sed 's/%25/%/g' > commits-temp.txt + sed -i '/COMMITS_PLACEHOLDER/r commits-temp.txt' updated-section.md + sed -i '/COMMITS_PLACEHOLDER/d' updated-section.md + + UPDATED_SECTION=$(cat updated-section.md) # Update or append the updated section if echo "$CURRENT_BODY" | grep -q "### 🔄 Last Updated:"; then diff --git a/.github/workflows/pr-check.yml b/.github/workflows/pr-check.yml index b3c6807..16afc31 100644 --- a/.github/workflows/pr-check.yml +++ b/.github/workflows/pr-check.yml @@ -47,9 +47,9 @@ jobs: if [ -n "$(ls -A .changeset/*.md 2>/dev/null | grep -v README.md)" ]; then echo "✅ Changeset found" else - echo "⚠️ No changeset found. Please add a changeset with 'pnpm changeset add'" - echo " This is required for all changes that affect published packages." - exit 1 + echo "⚠️ No changeset found. Consider adding a changeset with 'pnpm changeset add'" + echo " Changesets are recommended for changes that affect published packages." + echo " (Not required for documentation, CI/CD, or other non-package changes)" fi build: diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index 11a1333..e9783c1 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -138,43 +138,17 @@ jobs: run: | echo "🔄 Syncing changes to develop branch..." - # Fetch latest develop + # Fetch and checkout develop git fetch origin develop:develop - - # Create sync branch - SYNC_BRANCH="sync/main-to-develop-$(date +%s)" - git checkout -b $SYNC_BRANCH + git checkout develop # Merge main changes git merge main --no-ff -m "chore: sync version updates from main" - # Push sync branch - git push origin $SYNC_BRANCH - - # Create PR - VERSION="${{ steps.version-update.outputs.version }}" + # Push directly to develop + git push origin develop - { - echo "## 🔄 Version Sync from Main" - echo "" - echo "### 📦 Updated Versions" - echo "This PR syncs the stable version updates from main to develop." - echo "" - echo "Version: **v$VERSION**" - echo "" - echo "### ⚡ Auto-merge" - echo "This PR should be merged automatically to keep branches in sync." - echo "" - echo "---" - echo "*This PR was automatically created by the version update workflow*" - } > pr-body.md - - gh pr create \ - --base develop \ - --head $SYNC_BRANCH \ - --title "🔄 Sync: main → develop (v$VERSION)" \ - --body-file pr-body.md \ - --label "auto-updated" + echo "✅ Successfully synced main to develop" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -182,46 +156,17 @@ jobs: run: | echo "🔄 Syncing changes to staging branch..." - # Checkout main again - git checkout main - - # Fetch latest staging + # Fetch and checkout staging git fetch origin staging:staging - - # Create sync branch - SYNC_BRANCH="sync/main-to-staging-$(date +%s)" - git checkout -b $SYNC_BRANCH + git checkout staging # Merge main changes git merge main --no-ff -m "chore: sync version updates from main" - # Push sync branch - git push origin $SYNC_BRANCH - - # Create PR - VERSION="${{ steps.version-update.outputs.version }}" + # Push directly to staging + git push origin staging - { - echo "## 🔄 Version Sync from Main" - echo "" - echo "### 📦 Updated Versions" - echo "This PR syncs the stable version updates from main to staging." - echo "" - echo "Version: **v$VERSION**" - echo "" - echo "### ⚡ Auto-merge" - echo "This PR should be merged automatically to keep branches in sync." - echo "" - echo "---" - echo "*This PR was automatically created by the version update workflow*" - } > pr-body-staging.md - - gh pr create \ - --base staging \ - --head $SYNC_BRANCH \ - --title "🔄 Sync: main → staging (v$VERSION)" \ - --body-file pr-body-staging.md \ - --label "auto-updated" + echo "✅ Successfully synced main to staging" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}