@@ -85,11 +85,23 @@ jobs:
8585 run : |
8686 gh repo clone kernel/kernel /tmp/kernel-api -- --depth=1
8787
88- - name : Clone CLI repo
88+ - name : Clone CLI repo and checkout existing branch
8989 env :
9090 GH_TOKEN : ${{ secrets.GH_TOKEN }}
9191 run : |
9292 gh repo clone kernel/cli /tmp/kernel-cli
93+ cd /tmp/kernel-cli
94+
95+ # Check if the cli-coverage-update branch already exists on remote
96+ if git ls-remote --exit-code --heads origin cli-coverage-update >/dev/null 2>&1; then
97+ echo "Branch cli-coverage-update exists, checking it out..."
98+ git fetch origin cli-coverage-update
99+ git checkout cli-coverage-update
100+ # Merge latest main to keep it up to date
101+ git merge origin/main -m "Merge main into cli-coverage-update" --no-edit || true
102+ else
103+ echo "Branch cli-coverage-update does not exist, will create from main"
104+ fi
93105
94106 - name : Get SDK version info
95107 id : sdk-version
@@ -213,10 +225,12 @@ jobs:
213225 - Run \`go build ./...\` to verify the code compiles
214226
215227 ## Step 6: Commit and Push
216- - Create/update the evergreen branch: cli-coverage-update (always use this single branch name)
228+ - You should already be on the cli-coverage-update branch (it was checked out during setup if it existed)
229+ - If you're on main, create/switch to the cli-coverage-update branch
217230 - Commit with message describing SDK version bump and any new commands/flags
218- - Force push changes to the CLI repo (since we're updating an evergreen branch)
219- - Create or update an evergreen PR in kernel/cli
231+ - IMPORTANT: Do NOT force push! Use regular \`git push origin cli-coverage-update\` to preserve existing work on the branch
232+ - If push fails due to divergence, pull and rebase first: \`git pull --rebase origin cli-coverage-update\`
233+ - Create or update the PR in kernel/cli
220234
221235 # SDK Method -> CLI Command Mapping Guide
222236 - client.Resource.New() -> kernel resource create
0 commit comments