Skip to content

Commit fce33b6

Browse files
authored
fix(ci): use opentelemetrybot to sync package-lock.json on release PRs (#1817)
* fix(ci): use opentelemetrybot to sync package-lock.json on release PRs * fix: comment typo * fix: token is named RELEASE_PR_TOKEN
1 parent 434cab2 commit fce33b6

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

.github/workflows/release-please.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,9 @@ jobs:
2020
node-version: 18
2121
registry-url: 'https://registry.npmjs.org'
2222

23-
- name: Build Packages
23+
- name: Install packages
2424
run: |
2525
npm ci
26-
npm run compile
2726
2827
- uses: google-github-actions/release-please-action@v3
2928
id: release
@@ -32,6 +31,41 @@ jobs:
3231
token: ${{secrets.RELEASE_PR_TOKEN}}
3332
default-branch: main
3433

34+
# get release PR as we're currently on main
35+
- name: Checkout release PR
36+
# only checkout if a PR has been created, otherwise this will fail
37+
if: ${{ steps.release.outputs.pr }}
38+
uses: actions/checkout@v4
39+
with:
40+
ref: release-please--branches--main
41+
# use a token so that workflows on the PR run when we push later
42+
token: ${{ secrets.RELEASE_PR_TOKEN }}
43+
44+
# release-please does not do this on its own, so we do it here instead
45+
- name: Update package-lock.json in PR
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.RELEASE_PR_TOKEN }}
48+
# only update if a PR has been created
49+
if: ${{ steps.release.outputs.pr }}
50+
run: |
51+
npm install --ignore-scripts --package-lock-only
52+
git add package-lock.json
53+
git config user.name opentelemetrybot
54+
git config user.email [email protected]
55+
git commit -m "chore: sync package-lock.json"
56+
git push
57+
58+
# get main again
59+
- name: Checkout Repository
60+
uses: actions/checkout@v4
61+
with:
62+
fetch-depth: 0
63+
64+
- name: Rebuild Packages
65+
run: |
66+
npm ci
67+
npm run compile
68+
3569
# Release Please has already incremented versions and published tags, so we just
3670
# need to publish all unpublished versions to npm here
3771
# See: https://github.com/lerna/lerna/tree/main/commands/publish#bump-from-package

0 commit comments

Comments
 (0)