Skip to content

Commit 335c4df

Browse files
committed
ci: sync lockfile on push to main too, self-heal after any bot PR
1 parent c0fde0d commit 335c4df

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

.github/workflows/sync-lockfile.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,27 @@ name: Sync Lockfile
22

33
on:
44
pull_request:
5-
paths: ['package.json']
5+
paths: ["package.json"]
6+
push:
7+
branches: [main, master]
8+
paths: ["package.json"]
69

710
permissions:
811
contents: write
912

1013
jobs:
1114
sync:
12-
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.event.pull_request.state == 'open'
15+
if: >
16+
github.event_name == 'push' ||
17+
(github.event_name == 'pull_request' &&
18+
github.event.pull_request.user.login == 'dependabot[bot]' &&
19+
github.event.pull_request.state == 'open')
1320
runs-on: ubuntu-latest
1421
timeout-minutes: 10
1522
steps:
1623
- uses: actions/checkout@v6
1724
with:
18-
ref: ${{ github.head_ref }}
25+
ref: ${{ github.event_name == 'push' && github.ref || github.head_ref }}
1926
token: ${{ secrets.GITHUB_TOKEN }}
2027

2128
- uses: oven-sh/setup-bun@v2
@@ -32,5 +39,5 @@ jobs:
3239
exit 0
3340
fi
3441
git commit -m "chore: sync bun.lock"
35-
git pull --rebase origin ${{ github.head_ref }}
42+
git pull --rebase origin ${{ github.event_name == 'push' && github.ref_name || github.head_ref }}
3643
git push

0 commit comments

Comments
 (0)