[Infrastructure] Add a github workflow to update NPM dependencies #6
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
name: update-npm-dependencies | |
on: | |
# Manual run | |
workflow_dispatch: | |
pull_request: | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
jobs: | |
update-npm-dependencies: | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Checkout submodule | |
run: git submodule update --init --recursive | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
- name: Set up git user name and email | |
run: | | |
git config --global user.name "dotnet-maestro[bot]" | |
git config --global user.email "42748379+dotnet-maestro[bot]@users.noreply.github.com" | |
- name: Run script | |
shell: pwsh | |
id: update-npm-dependencies | |
run: ./.github/workflows/update-npm-dependencies.ps1 | |
- name: Create PR to update the offline package cache | |
if: steps.update-npm-dependencies.outputs.changes == 'true' | |
uses: dotnet/actions-create-pull-request@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
path: ./src/submodules/Node-Externals/ | |
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:' | |
base: main | |
branch: github-action/update-npm-dependencies | |
branch-suffix: timestamp | |
- name: Create PR to update package-lock.json and the offline package cache submodule | |
if: steps.update-npm-dependencies.outputs.changes == 'true' | |
uses: dotnet/actions-create-pull-request@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
title: '[Infrastructure] Update npm dependencies' | |
body: 'Updates the package-lock.json file and the offline package cache submodule to match it.' | |
labels: 'Type: Dependency Update :arrow_up_small:' | |
base: main | |
branch: github-action/update-npm-dependencies | |
branch-suffix: timestamp |