Skip to content

Commit

Permalink
update script
Browse files Browse the repository at this point in the history
  • Loading branch information
raulfdm committed Nov 18, 2024
1 parent 54f0b9d commit 30a674d
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions scripts/bun-update-lock.ts
Original file line number Diff line number Diff line change
@@ -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');

Expand All @@ -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<T>(
value: T | undefined | null,
Expand Down

0 comments on commit 30a674d

Please sign in to comment.