Skip to content

Commit

Permalink
fix(ci): use opentelemetrybot to sync package-lock.json on release PRs (
Browse files Browse the repository at this point in the history
#1817)

* fix(ci): use opentelemetrybot to sync package-lock.json on release PRs

* fix: comment typo

* fix: token is named RELEASE_PR_TOKEN
  • Loading branch information
pichlermarc authored Nov 22, 2023
1 parent 434cab2 commit fce33b6
Showing 1 changed file with 36 additions and 2 deletions.
38 changes: 36 additions & 2 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ jobs:
node-version: 18
registry-url: 'https://registry.npmjs.org'

- name: Build Packages
- name: Install packages
run: |
npm ci
npm run compile
- uses: google-github-actions/release-please-action@v3
id: release
Expand All @@ -32,6 +31,41 @@ jobs:
token: ${{secrets.RELEASE_PR_TOKEN}}
default-branch: main

# get release PR as we're currently on main
- name: Checkout release PR
# only checkout if a PR has been created, otherwise this will fail
if: ${{ steps.release.outputs.pr }}
uses: actions/checkout@v4
with:
ref: release-please--branches--main
# use a token so that workflows on the PR run when we push later
token: ${{ secrets.RELEASE_PR_TOKEN }}

# release-please does not do this on its own, so we do it here instead
- name: Update package-lock.json in PR
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_PR_TOKEN }}
# only update if a PR has been created
if: ${{ steps.release.outputs.pr }}
run: |
npm install --ignore-scripts --package-lock-only
git add package-lock.json
git config user.name opentelemetrybot
git config user.email 107717825+opentelemetrybot@users.noreply.github.com
git commit -m "chore: sync package-lock.json"
git push
# get main again
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Rebuild Packages
run: |
npm ci
npm run compile
# Release Please has already incremented versions and published tags, so we just
# need to publish all unpublished versions to npm here
# See: https://github.com/lerna/lerna/tree/main/commands/publish#bump-from-package
Expand Down

0 comments on commit fce33b6

Please sign in to comment.