-
Notifications
You must be signed in to change notification settings - Fork 10k
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
[Infrastructure] Add a github workflow to update NPM dependencies #54000
Conversation
cf2a973
to
fc8f3e7
Compare
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.
Just nits
# Update the .npmrc file to point to the cache location as a repo instead of a submodule | ||
$npmrcPath = Join-Path -Path $repoRoot -ChildPath ".npmrc" | ||
$content = Get-Content -Path $npmrcPath; | ||
$content = $content -replace "cache=./src/submodules/Node-Externals/cache", "cache=../Node-Externals/cache"; |
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.
To confirm, the new value is outside the repo root?
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.
I wonder if it could be passed in as an argument so this script wouldn't need knowledge of the workflow?
uses: actions/checkout@v4 | ||
with: | ||
repository: 'dotnet/Node-Externals' | ||
path: 'node-externals' |
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.
Nit: powershell appears to look for Node-Externals
above. But maybe powershell is case-insensitive on all platforms?
run: | | ||
./.github/workflows/update-submodule-commit.ps1 ${{ steps.update-offline-package-cache.outputs.pull-request-head-sha }} | ||
|
||
- name: Create PR to update package-lock.json and the offline package cache submodule |
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.
It would be cool if this linked to the other PR, but I can see how that might be tricky.
commit-message: 'Update the NPM offline cache' | ||
title: '[Infrastructure] Update the NPM offline cache' | ||
body: 'Updates the npm offline cache to match the associated package-lock.json file in dotnet/aspnetcore.' | ||
labels: 'Type: Dependency Update :arrow_up_small:' |
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.
I wonder if this can be done by label ID so it doesn't get out of sync if someone tweaks the emoji or something?
Switched the approach here and made a script that can be run locally instead and creates the PRs via |
The workflow removes package-lock.json, runs npm install and if there are changes, it creates a commit for the submodule and a commit for the parent module and sends PRs to the respective repos