From 88cbfc930b0208d6b1cc716a39bfaaebe7d94502 Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Tue, 5 Aug 2025 20:27:06 +0900 Subject: [PATCH 01/11] fix: prevent infinite loop in workflow automation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add condition to skip integrate-develop workflow for sync commits from main - Prevents develop→staging→main→develop infinite loop - Ignores commits with 'chore: sync version updates from main' message --- .github/workflows/integrate-develop.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/integrate-develop.yml b/.github/workflows/integrate-develop.yml index 03c1742..d436ab5 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') && !contains(github.event.head_commit.message, 'Sync: main → develop') }} permissions: contents: write pull-requests: write From fb39cde69187dfa8a46efce0ed1090885bd284e7 Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Tue, 5 Aug 2025 20:27:49 +0900 Subject: [PATCH 02/11] fix: make changesets optional in PR checks - Remove exit 1 when no changeset found - Changesets only required for actual package changes - Allow PRs for docs, CI/CD, and other non-package changes --- .github/workflows/pr-check.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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: From 04a40451dedfb68934e35fb51e6a1ca82aa163ac Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Tue, 5 Aug 2025 20:29:20 +0900 Subject: [PATCH 03/11] feat: add auto-merge for version sync PRs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Enable auto-merge for main → develop sync PRs - Enable auto-merge for main → staging sync PRs - Automatically merge version synchronization to keep branches in sync - Uses --auto --merge flags to merge when all checks pass --- .github/workflows/update-version.yml | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index 11a1333..d38e281 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -169,12 +169,19 @@ jobs: echo "*This PR was automatically created by the version update workflow*" } > pr-body.md - gh pr create \ + PR_URL=$(gh pr create \ --base develop \ --head $SYNC_BRANCH \ --title "🔄 Sync: main → develop (v$VERSION)" \ --body-file pr-body.md \ - --label "auto-updated" + --label "auto-updated") + + # Extract PR number from URL + PR_NUMBER=$(echo $PR_URL | grep -oE '[0-9]+$') + + # Enable auto-merge + echo "Enabling auto-merge for PR #$PR_NUMBER..." + gh pr merge $PR_NUMBER --auto --merge env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -216,12 +223,19 @@ jobs: echo "*This PR was automatically created by the version update workflow*" } > pr-body-staging.md - gh pr create \ + PR_URL=$(gh pr create \ --base staging \ --head $SYNC_BRANCH \ --title "🔄 Sync: main → staging (v$VERSION)" \ --body-file pr-body-staging.md \ - --label "auto-updated" + --label "auto-updated") + + # Extract PR number from URL + PR_NUMBER=$(echo $PR_URL | grep -oE '[0-9]+$') + + # Enable auto-merge + echo "Enabling auto-merge for PR #$PR_NUMBER..." + gh pr merge $PR_NUMBER --auto --merge env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 2c2708e13183926fe1ca6d55c5444f9cdec1258e Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Tue, 5 Aug 2025 20:30:43 +0900 Subject: [PATCH 04/11] fix: improve sync commit detection to prevent loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Check for 'sync version updates from main' in commit message - Check for 'Sync: main → develop' in PR title - Skip PRs from sync/main-to-develop branches - More robust detection to handle different merge strategies --- .github/workflows/integrate-develop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integrate-develop.yml b/.github/workflows/integrate-develop.yml index d436ab5..97f83cd 100644 --- a/.github/workflows/integrate-develop.yml +++ b/.github/workflows/integrate-develop.yml @@ -14,7 +14,7 @@ jobs: 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') && !contains(github.event.head_commit.message, 'Sync: main → develop') }} + if: ${{ !contains(github.event.head_commit.message, 'sync version updates from main') && !contains(github.event.head_commit.message, 'Sync: main → develop') && !startsWith(github.event.head_commit.message, 'Merge pull request') && github.event.head_commit.author.name != 'github-actions[bot]' || !contains(github.event.head_commit.message, 'sync/main-to-develop') }} permissions: contents: write pull-requests: write From a7c7e5d8fd816f2efc9ef310f9d10168335b9682 Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Tue, 5 Aug 2025 20:33:17 +0900 Subject: [PATCH 05/11] refactor: simplify version sync workflow - Remove unnecessary sync branch creation - Create PRs directly from main to develop/staging - Simplify infinite loop prevention logic - More efficient and cleaner workflow --- .github/workflows/integrate-develop.yml | 4 +-- .github/workflows/update-version.yml | 45 +++++-------------------- 2 files changed, 10 insertions(+), 39 deletions(-) diff --git a/.github/workflows/integrate-develop.yml b/.github/workflows/integrate-develop.yml index 97f83cd..6d81b74 100644 --- a/.github/workflows/integrate-develop.yml +++ b/.github/workflows/integrate-develop.yml @@ -13,8 +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, 'sync version updates from main') && !contains(github.event.head_commit.message, 'Sync: main → develop') && !startsWith(github.event.head_commit.message, 'Merge pull request') && github.event.head_commit.author.name != 'github-actions[bot]' || !contains(github.event.head_commit.message, 'sync/main-to-develop') }} + # Skip if this is a merge from main branch sync PR + if: ${{ !contains(github.event.head_commit.message, 'Sync: main → develop') }} permissions: contents: write pull-requests: write diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index d38e281..5b892e7 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -136,22 +136,9 @@ jobs: - name: Sync to develop run: | - echo "🔄 Syncing changes to develop branch..." + echo "🔄 Creating PR to sync changes to develop branch..." - # Fetch latest develop - git fetch origin develop:develop - - # Create sync branch - SYNC_BRANCH="sync/main-to-develop-$(date +%s)" - git checkout -b $SYNC_BRANCH - - # 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 + # Create PR directly from main to develop VERSION="${{ steps.version-update.outputs.version }}" { @@ -163,7 +150,7 @@ jobs: echo "Version: **v$VERSION**" echo "" echo "### ⚡ Auto-merge" - echo "This PR should be merged automatically to keep branches in sync." + echo "This PR will be merged automatically to keep branches in sync." echo "" echo "---" echo "*This PR was automatically created by the version update workflow*" @@ -171,7 +158,7 @@ jobs: PR_URL=$(gh pr create \ --base develop \ - --head $SYNC_BRANCH \ + --head main \ --title "🔄 Sync: main → develop (v$VERSION)" \ --body-file pr-body.md \ --label "auto-updated") @@ -187,25 +174,9 @@ jobs: - name: Sync to staging run: | - echo "🔄 Syncing changes to staging branch..." - - # Checkout main again - git checkout main - - # Fetch latest staging - git fetch origin staging:staging - - # Create sync branch - SYNC_BRANCH="sync/main-to-staging-$(date +%s)" - git checkout -b $SYNC_BRANCH - - # Merge main changes - git merge main --no-ff -m "chore: sync version updates from main" - - # Push sync branch - git push origin $SYNC_BRANCH + echo "🔄 Creating PR to sync changes to staging branch..." - # Create PR + # Create PR directly from main to staging VERSION="${{ steps.version-update.outputs.version }}" { @@ -217,7 +188,7 @@ jobs: echo "Version: **v$VERSION**" echo "" echo "### ⚡ Auto-merge" - echo "This PR should be merged automatically to keep branches in sync." + echo "This PR will be merged automatically to keep branches in sync." echo "" echo "---" echo "*This PR was automatically created by the version update workflow*" @@ -225,7 +196,7 @@ jobs: PR_URL=$(gh pr create \ --base staging \ - --head $SYNC_BRANCH \ + --head main \ --title "🔄 Sync: main → staging (v$VERSION)" \ --body-file pr-body-staging.md \ --label "auto-updated") From 902999d3e18412c2acfeb82137843db12336b398 Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Tue, 5 Aug 2025 20:33:35 +0900 Subject: [PATCH 06/11] Revert "refactor: simplify version sync workflow" This reverts commit a7c7e5d8fd816f2efc9ef310f9d10168335b9682. --- .github/workflows/integrate-develop.yml | 4 +-- .github/workflows/update-version.yml | 45 ++++++++++++++++++++----- 2 files changed, 39 insertions(+), 10 deletions(-) diff --git a/.github/workflows/integrate-develop.yml b/.github/workflows/integrate-develop.yml index 6d81b74..97f83cd 100644 --- a/.github/workflows/integrate-develop.yml +++ b/.github/workflows/integrate-develop.yml @@ -13,8 +13,8 @@ jobs: create-or-update-pr: name: Create or Update PR to Staging runs-on: ubuntu-latest - # Skip if this is a merge from main branch sync PR - if: ${{ !contains(github.event.head_commit.message, 'Sync: main → develop') }} + # Skip if this is a sync commit from main + if: ${{ !contains(github.event.head_commit.message, 'sync version updates from main') && !contains(github.event.head_commit.message, 'Sync: main → develop') && !startsWith(github.event.head_commit.message, 'Merge pull request') && github.event.head_commit.author.name != 'github-actions[bot]' || !contains(github.event.head_commit.message, 'sync/main-to-develop') }} permissions: contents: write pull-requests: write diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index 5b892e7..d38e281 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -136,9 +136,22 @@ jobs: - name: Sync to develop run: | - echo "🔄 Creating PR to sync changes to develop branch..." + echo "🔄 Syncing changes to develop branch..." - # Create PR directly from main to develop + # Fetch latest develop + git fetch origin develop:develop + + # Create sync branch + SYNC_BRANCH="sync/main-to-develop-$(date +%s)" + git checkout -b $SYNC_BRANCH + + # 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 }}" { @@ -150,7 +163,7 @@ jobs: echo "Version: **v$VERSION**" echo "" echo "### ⚡ Auto-merge" - echo "This PR will be merged automatically to keep branches in sync." + 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*" @@ -158,7 +171,7 @@ jobs: PR_URL=$(gh pr create \ --base develop \ - --head main \ + --head $SYNC_BRANCH \ --title "🔄 Sync: main → develop (v$VERSION)" \ --body-file pr-body.md \ --label "auto-updated") @@ -174,9 +187,25 @@ jobs: - name: Sync to staging run: | - echo "🔄 Creating PR to sync changes to staging branch..." + echo "🔄 Syncing changes to staging branch..." + + # Checkout main again + git checkout main + + # Fetch latest staging + git fetch origin staging:staging + + # Create sync branch + SYNC_BRANCH="sync/main-to-staging-$(date +%s)" + git checkout -b $SYNC_BRANCH + + # 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 directly from main to staging + # Create PR VERSION="${{ steps.version-update.outputs.version }}" { @@ -188,7 +217,7 @@ jobs: echo "Version: **v$VERSION**" echo "" echo "### ⚡ Auto-merge" - echo "This PR will be merged automatically to keep branches in sync." + 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*" @@ -196,7 +225,7 @@ jobs: PR_URL=$(gh pr create \ --base staging \ - --head main \ + --head $SYNC_BRANCH \ --title "🔄 Sync: main → staging (v$VERSION)" \ --body-file pr-body-staging.md \ --label "auto-updated") From 6212efcb089523886c2afa5468c1ec55894c18df Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Tue, 5 Aug 2025 20:36:10 +0900 Subject: [PATCH 07/11] fix: simplify sync workflow with direct push - Remove unnecessary PR creation for develop/staging sync - Push directly to develop and staging branches - No branch protection rules on these branches - Much simpler and faster synchronization --- .github/workflows/update-version.yml | 89 ++++------------------------ 1 file changed, 10 insertions(+), 79 deletions(-) diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index d38e281..e034112 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -138,50 +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 }}" - - { - 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 - - PR_URL=$(gh pr create \ - --base develop \ - --head $SYNC_BRANCH \ - --title "🔄 Sync: main → develop (v$VERSION)" \ - --body-file pr-body.md \ - --label "auto-updated") - - # Extract PR number from URL - PR_NUMBER=$(echo $PR_URL | grep -oE '[0-9]+$') + # Push directly to develop + git push origin develop - # Enable auto-merge - echo "Enabling auto-merge for PR #$PR_NUMBER..." - gh pr merge $PR_NUMBER --auto --merge + echo "✅ Successfully synced main to develop" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -189,53 +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 }}" - - { - 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 - - PR_URL=$(gh pr create \ - --base staging \ - --head $SYNC_BRANCH \ - --title "🔄 Sync: main → staging (v$VERSION)" \ - --body-file pr-body-staging.md \ - --label "auto-updated") - - # Extract PR number from URL - PR_NUMBER=$(echo $PR_URL | grep -oE '[0-9]+$') + # Push directly to staging + git push origin staging - # Enable auto-merge - echo "Enabling auto-merge for PR #$PR_NUMBER..." - gh pr merge $PR_NUMBER --auto --merge + echo "✅ Successfully synced main to staging" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From dfca2a977467432b252dfe717cc4b16e99ee89f8 Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Tue, 5 Aug 2025 20:38:53 +0900 Subject: [PATCH 08/11] fix: correct workflow syntax errors - Fix integrate-develop.yml condition syntax - Remove trailing spaces from update-version.yml - All workflows now pass yamllint validation --- .github/workflows/integrate-develop.yml | 2 +- .github/workflows/update-version.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integrate-develop.yml b/.github/workflows/integrate-develop.yml index 97f83cd..b129aa5 100644 --- a/.github/workflows/integrate-develop.yml +++ b/.github/workflows/integrate-develop.yml @@ -14,7 +14,7 @@ jobs: 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, 'sync version updates from main') && !contains(github.event.head_commit.message, 'Sync: main → develop') && !startsWith(github.event.head_commit.message, 'Merge pull request') && github.event.head_commit.author.name != 'github-actions[bot]' || !contains(github.event.head_commit.message, 'sync/main-to-develop') }} + if: "!contains(github.event.head_commit.message, 'chore: sync version updates from main')" permissions: contents: write pull-requests: write diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml index e034112..e9783c1 100644 --- a/.github/workflows/update-version.yml +++ b/.github/workflows/update-version.yml @@ -147,7 +147,7 @@ jobs: # Push directly to develop git push origin develop - + echo "✅ Successfully synced main to develop" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} @@ -165,7 +165,7 @@ jobs: # Push directly to staging git push origin staging - + echo "✅ Successfully synced main to staging" env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From d01830deae7867ae54aacc9c6a4ab852edebf6e2 Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Tue, 5 Aug 2025 21:32:34 +0900 Subject: [PATCH 09/11] fix: decode URL-encoded characters in PR body update - Fix shell execution error caused by %0A in commit messages - Properly decode %0A, %0D, %25 back to readable format - Prevents 'command not found' errors in workflow --- .github/workflows/integrate-develop.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integrate-develop.yml b/.github/workflows/integrate-develop.yml index b129aa5..6c27178 100644 --- a/.github/workflows/integrate-develop.yml +++ b/.github/workflows/integrate-develop.yml @@ -130,8 +130,10 @@ 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 proper escaping + # Decode %0A back to actual newlines for proper display + DECODED_COMMITS=$(echo "${COMMITS}" | sed 's/%0A/\n/g' | sed 's/%0D//g' | sed 's/%25/%/g') + UPDATED_SECTION="### 🔄 Last Updated: ${TIMESTAMP}\nNew commits: ${COMMIT_COUNT}\n\n### 📝 Recent Commits\n${DECODED_COMMITS}" # Update or append the updated section if echo "$CURRENT_BODY" | grep -q "### 🔄 Last Updated:"; then From e5a698e051fc8b1b8eca3bcbc394dc567c399294 Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Tue, 5 Aug 2025 21:43:01 +0900 Subject: [PATCH 10/11] fix: use file-based approach for PR body update - Replace problematic variable substitution with file-based approach - Prevents shell command interpretation of commit messages - Safer handling of URL-encoded characters --- .github/workflows/integrate-develop.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/integrate-develop.yml b/.github/workflows/integrate-develop.yml index 6c27178..59a84e7 100644 --- a/.github/workflows/integrate-develop.yml +++ b/.github/workflows/integrate-develop.yml @@ -130,10 +130,15 @@ jobs: # Get current PR body CURRENT_BODY=$(gh pr view $PR_NUMBER --json body --jq '.body') - # Create updated section with proper escaping - # Decode %0A back to actual newlines for proper display - DECODED_COMMITS=$(echo "${COMMITS}" | sed 's/%0A/\n/g' | sed 's/%0D//g' | sed 's/%25/%/g') - UPDATED_SECTION="### 🔄 Last Updated: ${TIMESTAMP}\nNew commits: ${COMMIT_COUNT}\n\n### 📝 Recent Commits\n${DECODED_COMMITS}" + # Create updated section safely using file approach + { + echo "### 🔄 Last Updated: ${TIMESTAMP}" + echo "New commits: ${COMMIT_COUNT}" + echo "" + echo "### 📝 Recent Commits" + echo "${COMMITS}" | sed 's/%0A/\n/g' | sed 's/%0D//g' | sed 's/%25/%/g' + } > updated-section.md + UPDATED_SECTION=$(cat updated-section.md) # Update or append the updated section if echo "$CURRENT_BODY" | grep -q "### 🔄 Last Updated:"; then From da2bb7d3afbe9c7ce352b91bbf93b32ce840a135 Mon Sep 17 00:00:00 2001 From: Seungwoo321 Date: Tue, 5 Aug 2025 21:46:31 +0900 Subject: [PATCH 11/11] fix: use heredoc with placeholders to avoid shell interpretation - Use heredoc with placeholders instead of variable substitution - Process commits safely through temporary file - Completely prevent shell command interpretation --- .github/workflows/integrate-develop.yml | 26 +++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/integrate-develop.yml b/.github/workflows/integrate-develop.yml index 59a84e7..2837821 100644 --- a/.github/workflows/integrate-develop.yml +++ b/.github/workflows/integrate-develop.yml @@ -130,14 +130,24 @@ jobs: # Get current PR body CURRENT_BODY=$(gh pr view $PR_NUMBER --json body --jq '.body') - # Create updated section safely using file approach - { - echo "### 🔄 Last Updated: ${TIMESTAMP}" - echo "New commits: ${COMMIT_COUNT}" - echo "" - echo "### 📝 Recent Commits" - echo "${COMMITS}" | sed 's/%0A/\n/g' | sed 's/%0D//g' | sed 's/%25/%/g' - } > updated-section.md + # 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