From cb7d8e7347ea0d1a6904dbe8d44152b751c93cef Mon Sep 17 00:00:00 2001 From: Pavel Dvorkin Date: Wed, 29 Oct 2025 11:33:46 -0400 Subject: [PATCH 1/9] INFRA-3041: Stable sync workflow fixes --- .github/workflows/stable-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stable-sync.yml b/.github/workflows/stable-sync.yml index e9fe15eb..73e9608a 100644 --- a/.github/workflows/stable-sync.yml +++ b/.github/workflows/stable-sync.yml @@ -132,7 +132,7 @@ jobs: - name: Create Pull Request if: steps.check-pr.outputs.result != 'true' env: - GITHUB_TOKEN: ${{ secrets.github-token }} + GITHUB_TOKEN: ${{ secrets.PR_TOKEN }} BRANCH_NAME: stable-main-${{ inputs.semver-version }} VERSION: ${{ inputs.semver-version }} run: | From 0aeb5cd0c9ce85c504862ca2e4e936e0172547e7 Mon Sep 17 00:00:00 2001 From: Pavel Dvorkin Date: Wed, 29 Oct 2025 14:46:08 -0400 Subject: [PATCH 2/9] Use github-token again as env var --- .github/workflows/stable-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stable-sync.yml b/.github/workflows/stable-sync.yml index 73e9608a..e9fe15eb 100644 --- a/.github/workflows/stable-sync.yml +++ b/.github/workflows/stable-sync.yml @@ -132,7 +132,7 @@ jobs: - name: Create Pull Request if: steps.check-pr.outputs.result != 'true' env: - GITHUB_TOKEN: ${{ secrets.PR_TOKEN }} + GITHUB_TOKEN: ${{ secrets.github-token }} BRANCH_NAME: stable-main-${{ inputs.semver-version }} VERSION: ${{ inputs.semver-version }} run: | From b915d032e3cdb990d69025a3ddbd3fc20285d2d7 Mon Sep 17 00:00:00 2001 From: Pavel Dvorkin Date: Wed, 29 Oct 2025 15:14:28 -0400 Subject: [PATCH 3/9] Testing a fix --- .github/workflows/stable-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stable-sync.yml b/.github/workflows/stable-sync.yml index e9fe15eb..df671a65 100644 --- a/.github/workflows/stable-sync.yml +++ b/.github/workflows/stable-sync.yml @@ -132,7 +132,7 @@ jobs: - name: Create Pull Request if: steps.check-pr.outputs.result != 'true' env: - GITHUB_TOKEN: ${{ secrets.github-token }} + GH_TOKEN: ${{ secrets.github-token }} BRANCH_NAME: stable-main-${{ inputs.semver-version }} VERSION: ${{ inputs.semver-version }} run: | From 45611164857ad750eefd1035086d5e9192f9f2ac Mon Sep 17 00:00:00 2001 From: Pavel Dvorkin Date: Thu, 30 Oct 2025 10:41:28 -0400 Subject: [PATCH 4/9] Return github_token --- .github/workflows/stable-sync.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/stable-sync.yml b/.github/workflows/stable-sync.yml index df671a65..e9fe15eb 100644 --- a/.github/workflows/stable-sync.yml +++ b/.github/workflows/stable-sync.yml @@ -132,7 +132,7 @@ jobs: - name: Create Pull Request if: steps.check-pr.outputs.result != 'true' env: - GH_TOKEN: ${{ secrets.github-token }} + GITHUB_TOKEN: ${{ secrets.github-token }} BRANCH_NAME: stable-main-${{ inputs.semver-version }} VERSION: ${{ inputs.semver-version }} run: | From d7d281c675a14320828c3ba972ddecbf7e052f25 Mon Sep 17 00:00:00 2001 From: Pavel Dvorkin Date: Thu, 30 Oct 2025 11:57:13 -0400 Subject: [PATCH 5/9] INFRA-3041: Stable Branch sync workflow updates Signed-off-by: Pavel Dvorkin --- .github/scripts/stable-sync.js | 13 ++++--------- .github/workflows/stable-sync.yml | 6 ++++++ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/scripts/stable-sync.js b/.github/scripts/stable-sync.js index d5544eb9..37bec7ac 100644 --- a/.github/scripts/stable-sync.js +++ b/.github/scripts/stable-sync.js @@ -101,15 +101,10 @@ async function runGitCommands() { // Execute extension-specific commands if REPO is 'extension' else if (process.env.REPO === 'extension') { console.log('Executing extension-specific commands...'); - - const { stdout: packageJsonContent } = await exec( - `git show origin/${baseBranch}:package.json`, - ); - const packageJson = JSON.parse(packageJsonContent); - const packageVersion = packageJson.version; - - await exec(`yarn version "${packageVersion}"`); - console.log('Executed: yarn version'); + + // Preserve package.json from stable branch (no version bump) + await exec(`git checkout origin/${baseBranch} -- package.json`); + console.log(`Executed: git checkout origin/${baseBranch} -- package.json`); } // If REPO is not set or has an invalid value, skip both else { diff --git a/.github/workflows/stable-sync.yml b/.github/workflows/stable-sync.yml index e9fe15eb..4b1abf15 100644 --- a/.github/workflows/stable-sync.yml +++ b/.github/workflows/stable-sync.yml @@ -119,9 +119,15 @@ jobs: # Check if branch exists remotely echo "Cleaning up github-tools" rm -rf github-tools + # Ensure github-tools is not staged or tracked + git rm -rf --cached github-tools 2>/dev/null || true + git clean -fd github-tools 2>/dev/null || true BRANCH_NAME="stable-main-${{ inputs.semver-version }}" if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then git pull --rebase + # Remove github-tools again after rebase in case it was reintroduced + rm -rf github-tools + git rm -rf --cached github-tools 2>/dev/null || true echo "Branch $BRANCH_NAME exists remotely, pushing normally" git push origin "$BRANCH_NAME" --force else From a54caf527a77d3d1a795f0c5257cc45788b6eef1 Mon Sep 17 00:00:00 2001 From: Pavel Dvorkin Date: Thu, 30 Oct 2025 13:48:48 -0400 Subject: [PATCH 6/9] Fix: Handle github-tools cleanup during rebase and disable version bump --- .github/workflows/stable-sync.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/stable-sync.yml b/.github/workflows/stable-sync.yml index 4b1abf15..1906b024 100644 --- a/.github/workflows/stable-sync.yml +++ b/.github/workflows/stable-sync.yml @@ -122,12 +122,22 @@ jobs: # Ensure github-tools is not staged or tracked git rm -rf --cached github-tools 2>/dev/null || true git clean -fd github-tools 2>/dev/null || true + # Commit the removal if it's staged + if git diff --cached --quiet; then + echo "No staged changes for github-tools" + else + git commit -m "Remove github-tools directory" --no-verify || true + fi BRANCH_NAME="stable-main-${{ inputs.semver-version }}" if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then - git pull --rebase + git pull --rebase --strategy-option=theirs # Remove github-tools again after rebase in case it was reintroduced rm -rf github-tools git rm -rf --cached github-tools 2>/dev/null || true + # Amend the commit if github-tools reappeared + if ! git diff --cached --quiet; then + git commit --amend --no-edit --no-verify || true + fi echo "Branch $BRANCH_NAME exists remotely, pushing normally" git push origin "$BRANCH_NAME" --force else From b575fcfc8d0bba2b0d85419baeb6db7d837ee282 Mon Sep 17 00:00:00 2001 From: Pavel Dvorkin Date: Thu, 30 Oct 2025 13:57:53 -0400 Subject: [PATCH 7/9] Fix: Handle submodule conflicts during rebase --- .github/workflows/stable-sync.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/stable-sync.yml b/.github/workflows/stable-sync.yml index 1906b024..e9e2aab2 100644 --- a/.github/workflows/stable-sync.yml +++ b/.github/workflows/stable-sync.yml @@ -130,7 +130,22 @@ jobs: fi BRANCH_NAME="stable-main-${{ inputs.semver-version }}" if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then - git pull --rebase --strategy-option=theirs + # Configure git to ignore submodules during operations + git config submodule.recurse false + git config diff.ignoreSubmodules all + + # Start the rebase + if ! git pull --rebase --strategy-option=theirs --no-recurse-submodules; then + echo "Rebase had conflicts, attempting to resolve..." + # If rebase failed, likely due to submodule conflict + # Remove github-tools and mark as resolved + rm -rf github-tools + git rm -rf --cached github-tools 2>/dev/null || true + git add -A + # Continue the rebase + git rebase --continue || true + fi + # Remove github-tools again after rebase in case it was reintroduced rm -rf github-tools git rm -rf --cached github-tools 2>/dev/null || true From ca9bd06acfc3d091af3d1e20fd2e331425468d8b Mon Sep 17 00:00:00 2001 From: Pavel Dvorkin Date: Fri, 31 Oct 2025 14:13:33 -0400 Subject: [PATCH 8/9] Code review fixes --- .github/scripts/stable-sync.js | 12 ++------- .github/workflows/stable-sync.yml | 43 +++++-------------------------- 2 files changed, 9 insertions(+), 46 deletions(-) diff --git a/.github/scripts/stable-sync.js b/.github/scripts/stable-sync.js index 37bec7ac..dd3fe2fe 100644 --- a/.github/scripts/stable-sync.js +++ b/.github/scripts/stable-sync.js @@ -98,17 +98,9 @@ async function runGitCommands() { await exec(`git checkout origin/${baseBranch} -- package.json`); console.log(`Executed: git checkout origin/${baseBranch} -- package.json`); } - // Execute extension-specific commands if REPO is 'extension' - else if (process.env.REPO === 'extension') { - console.log('Executing extension-specific commands...'); - - // Preserve package.json from stable branch (no version bump) - await exec(`git checkout origin/${baseBranch} -- package.json`); - console.log(`Executed: git checkout origin/${baseBranch} -- package.json`); - } - // If REPO is not set or has an invalid value, skip both + // If REPO is not set or is 'extension', skip repo-specific commands else { - console.log('REPO environment variable not set or invalid. Skipping mobile/extension specific commands.'); + console.log('No repo-specific commands to execute.'); } await exec('git add .'); diff --git a/.github/workflows/stable-sync.yml b/.github/workflows/stable-sync.yml index e9e2aab2..f5baefb1 100644 --- a/.github/workflows/stable-sync.yml +++ b/.github/workflows/stable-sync.yml @@ -114,46 +114,17 @@ jobs: REPO: ${{ inputs.repo-type }} # Default to 'mobile' if not specified BASE_BRANCH: ${{ inputs.stable-branch-name }} run: | + # Ensure github-tools is in .gitignore to prevent it from being committed + if ! grep -q "^github-tools/" .gitignore 2>/dev/null; then + echo "github-tools/" >> .gitignore + echo "Added github-tools/ to .gitignore" + fi + # Execute the script from github-tools node ./github-tools/.github/scripts/stable-sync.js "stable-main-${{ inputs.semver-version }}" - # Check if branch exists remotely - echo "Cleaning up github-tools" - rm -rf github-tools - # Ensure github-tools is not staged or tracked - git rm -rf --cached github-tools 2>/dev/null || true - git clean -fd github-tools 2>/dev/null || true - # Commit the removal if it's staged - if git diff --cached --quiet; then - echo "No staged changes for github-tools" - else - git commit -m "Remove github-tools directory" --no-verify || true - fi BRANCH_NAME="stable-main-${{ inputs.semver-version }}" if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then - # Configure git to ignore submodules during operations - git config submodule.recurse false - git config diff.ignoreSubmodules all - - # Start the rebase - if ! git pull --rebase --strategy-option=theirs --no-recurse-submodules; then - echo "Rebase had conflicts, attempting to resolve..." - # If rebase failed, likely due to submodule conflict - # Remove github-tools and mark as resolved - rm -rf github-tools - git rm -rf --cached github-tools 2>/dev/null || true - git add -A - # Continue the rebase - git rebase --continue || true - fi - - # Remove github-tools again after rebase in case it was reintroduced - rm -rf github-tools - git rm -rf --cached github-tools 2>/dev/null || true - # Amend the commit if github-tools reappeared - if ! git diff --cached --quiet; then - git commit --amend --no-edit --no-verify || true - fi - echo "Branch $BRANCH_NAME exists remotely, pushing normally" + echo "Branch $BRANCH_NAME exists remotely, force pushing to overwrite" git push origin "$BRANCH_NAME" --force else echo "Branch $BRANCH_NAME doesn't exist remotely, pushing with --set-upstream" From ee74d68dd51b86fdee2f56f1b5b548c0f3545897 Mon Sep 17 00:00:00 2001 From: Pavel Dvorkin Date: Tue, 4 Nov 2025 16:33:42 -0500 Subject: [PATCH 9/9] Linting fix --- .github/workflows/stable-sync.yml | 2 +- .github/workflows/update-release-changelog.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/stable-sync.yml b/.github/workflows/stable-sync.yml index f5baefb1..71182f52 100644 --- a/.github/workflows/stable-sync.yml +++ b/.github/workflows/stable-sync.yml @@ -119,7 +119,7 @@ jobs: echo "github-tools/" >> .gitignore echo "Added github-tools/ to .gitignore" fi - + # Execute the script from github-tools node ./github-tools/.github/scripts/stable-sync.js "stable-main-${{ inputs.semver-version }}" BRANCH_NAME="stable-main-${{ inputs.semver-version }}" diff --git a/.github/workflows/update-release-changelog.yml b/.github/workflows/update-release-changelog.yml index 8bf58f8d..bc76cda4 100644 --- a/.github/workflows/update-release-changelog.yml +++ b/.github/workflows/update-release-changelog.yml @@ -79,4 +79,3 @@ jobs: "${{ inputs.platform }}" \ "${{ inputs.repository-url }}" \ "${{ inputs.previous-version-ref }}" -