File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,15 @@ async function makeOmicronPR(
160160// wrapped in a function so we can do early returns rather than early
161161// Deno.exits, which mess up the worktree cleanup
162162async function run ( commitIsh : string , dryRun : boolean , messageArg : string | undefined ) {
163- await $ `git fetch` . cwd ( OMICRON_DIR )
163+ // Ensure local main matches the remote so we don't bump to a stale commit
164+ if ( commitIsh === 'main' ) {
165+ const localMain = await $ `git rev-parse main` . text ( )
166+ const remoteMain = await $ `git ls-remote origin main` . text ( )
167+ const remoteMainSha = remoteMain . split ( '\t' ) [ 0 ]
168+ if ( localMain !== remoteMainSha ) {
169+ throw new Error ( 'Local main does not match remote. Fetch main and try again.' )
170+ }
171+ }
164172
165173 const oldConsoleCommit = await getOldCommit ( )
166174 const newConsoleCommit = await $ `git rev-parse ${ commitIsh } ` . text ( )
You can’t perform that action at this time.
0 commit comments