Skip to content

Commit 9ab6f28

Browse files
committed
fix(assets-updater): pull if needed
1 parent 9b898c1 commit 9ab6f28

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cli/src/commands/updateAssets.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,18 @@ export async function updateAssets() {
159159
core.info('Committing and pushing changes')
160160
execSync('git add .')
161161
execSync('git commit -m "chore: update assets"')
162-
execSync('git push --force-with-lease')
162+
163+
//* Fetch latest changes and attempt to push
164+
try {
165+
core.info('Fetching latest changes...')
166+
execSync('git fetch')
167+
execSync('git push --force-with-lease')
168+
}
169+
catch {
170+
core.warning('Failed to push with --force-with-lease, attempting to rebase and retry...')
171+
execSync('git pull --rebase')
172+
execSync('git push --force-with-lease')
173+
}
163174

164175
await octokit.rest.repos.createCommitStatus({
165176
...context.repo,

0 commit comments

Comments
 (0)