From 30a674d349d4c7950c2be0eac2fbbc5c7b67cbb6 Mon Sep 17 00:00:00 2001 From: Raul Melo Date: Mon, 18 Nov 2024 07:49:59 +0100 Subject: [PATCH] update script --- scripts/bun-update-lock.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/scripts/bun-update-lock.ts b/scripts/bun-update-lock.ts index 755cc5a01..cf4302053 100644 --- a/scripts/bun-update-lock.ts +++ b/scripts/bun-update-lock.ts @@ -1,4 +1,5 @@ import { $ } from 'bun'; + // GITHUB_REF_NAME: e.g., renovate/bits-ui-1.x invariant(process.env.GITHUB_REF_NAME, 'GITHUB_REF_NAME is not defined'); @@ -9,14 +10,21 @@ if (!process.env.GITHUB_REF_NAME.includes('renovate')) { await $`bun i`; -await $`git config --global user.email "bun-bot@raulmelo.me"`; -await $`git config --global user.name "Bun Bot"`; +const gitStatus = await $`git status`; + +if (gitStatus.text().includes('modified: bun.lockb')) { + await $`git config --global user.email "bun-bot@raulmelo.me"`; + await $`git config --global user.name "Bun Bot"`; -await $`git add bun.lockb`; + await $`git add bun.lockb`; -await $`git commit -m "chore: update bun.lock"`; + await $`git commit -m "chore: update bun.lock"`; -await $`git push origin HEAD`; + await $`git push origin HEAD`; +} else { + console.log('bun.lockb is not modified'); + process.exit(0); +} function invariant( value: T | undefined | null,