-
Notifications
You must be signed in to change notification settings - Fork 548
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(ci): use opentelemetrybot to sync package-lock.json on release PRs #1817
Merged
pichlermarc
merged 4 commits into
open-telemetry:main
from
dynatrace-oss-contrib:fix/release-please
Nov 22, 2023
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
5846f23
fix(ci): use opentelemetrybot to sync package-lock.json on release PRs
pichlermarc e70538f
fix: comment typo
pichlermarc 6d90d19
Merge branch 'main' into fix/release-please
pichlermarc d07fa9c
fix: token is named RELEASE_PR_TOKEN
pichlermarc File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,18 +20,52 @@ 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 | ||
with: | ||
command: manifest | ||
token: ${{secrets.RELEASE_PR_TOKEN}} | ||
token: ${{secrets.OPENTELEMETRYBOT_GITHUB_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.OPENTELEMETRYBOT_GITHUB_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.OPENTELEMETRYBOT_GITHUB_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 [email protected] | ||
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 | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: if you want to speed up the process you could avoid checking out again by cleaning up the workspace just after pushing you could add the following commands
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes we'd also have to check out main though as we might be on another branch at this point in the workflow.
It's also relatively quick (about 2s) compared to the rest of the workflow so I'd opt to keep it as-is (here's an example run https://github.com/pichlermarc-sample-organization/test-release-please/actions/runs/6941681633/job/18883019651). 🙂