Skip to content

Commit 79ce6e3

Browse files
authored
INFRA-3041: Stable sync workflow fixes (#154)
* INFRA-3041: Stable sync workflow fixes * Use github-token again as env var * Testing a fix * Return github_token * INFRA-3041: Stable Branch sync workflow updates Signed-off-by: Pavel Dvorkin <[email protected]> * Fix: Handle github-tools cleanup during rebase and disable version bump * Fix: Handle submodule conflicts during rebase * Code review fixes * Linting fix --------- Signed-off-by: Pavel Dvorkin <[email protected]>
1 parent 749c097 commit 79ce6e3

File tree

2 files changed

+9
-20
lines changed

2 files changed

+9
-20
lines changed

.github/scripts/stable-sync.js

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -98,22 +98,9 @@ async function runGitCommands() {
9898
await exec(`git checkout origin/${baseBranch} -- package.json`);
9999
console.log(`Executed: git checkout origin/${baseBranch} -- package.json`);
100100
}
101-
// Execute extension-specific commands if REPO is 'extension'
102-
else if (process.env.REPO === 'extension') {
103-
console.log('Executing extension-specific commands...');
104-
105-
const { stdout: packageJsonContent } = await exec(
106-
`git show origin/${baseBranch}:package.json`,
107-
);
108-
const packageJson = JSON.parse(packageJsonContent);
109-
const packageVersion = packageJson.version;
110-
111-
await exec(`yarn version "${packageVersion}"`);
112-
console.log('Executed: yarn version');
113-
}
114-
// If REPO is not set or has an invalid value, skip both
101+
// If REPO is not set or is 'extension', skip repo-specific commands
115102
else {
116-
console.log('REPO environment variable not set or invalid. Skipping mobile/extension specific commands.');
103+
console.log('No repo-specific commands to execute.');
117104
}
118105

119106
await exec('git add .');

.github/workflows/stable-sync.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,17 @@ jobs:
114114
REPO: ${{ inputs.repo-type }} # Default to 'mobile' if not specified
115115
BASE_BRANCH: ${{ inputs.stable-branch-name }}
116116
run: |
117+
# Ensure github-tools is in .gitignore to prevent it from being committed
118+
if ! grep -q "^github-tools/" .gitignore 2>/dev/null; then
119+
echo "github-tools/" >> .gitignore
120+
echo "Added github-tools/ to .gitignore"
121+
fi
122+
117123
# Execute the script from github-tools
118124
node ./github-tools/.github/scripts/stable-sync.js "stable-main-${{ inputs.semver-version }}"
119-
# Check if branch exists remotely
120-
echo "Cleaning up github-tools"
121-
rm -rf github-tools
122125
BRANCH_NAME="stable-main-${{ inputs.semver-version }}"
123126
if git ls-remote --heads origin "$BRANCH_NAME" | grep -q "$BRANCH_NAME"; then
124-
git pull --rebase
125-
echo "Branch $BRANCH_NAME exists remotely, pushing normally"
127+
echo "Branch $BRANCH_NAME exists remotely, force pushing to overwrite"
126128
git push origin "$BRANCH_NAME" --force
127129
else
128130
echo "Branch $BRANCH_NAME doesn't exist remotely, pushing with --set-upstream"

0 commit comments

Comments
 (0)