Skip to content

Commit 21f6bcd

Browse files
committed
feat(ci): pnpm updater
1 parent 274f68a commit 21f6bcd

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed

.github/workflows/pnpm-updater.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Security Notes
2+
# Only selected Actions are allowed within this repository. Please refer to (https://github.com/nodejs/nodejs.org/settings/actions)
3+
# for the full list of available actions. If you want to add a new one, please reach out a maintainer with Admin permissions.
4+
# REVIEWERS, please always double-check security practices before merging a PR that contains Workflow changes!!
5+
# AUTHORS, please only use actions with explicit SHA references, and avoid using `@master` or `@main` references or `@version` tags.
6+
7+
name: PNPM updater
8+
9+
on:
10+
schedule:
11+
- cron: "0 0 1 * *"
12+
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
17+
jobs:
18+
update-pnpm:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Harden Runner
23+
uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0
24+
with:
25+
egress-policy: audit
26+
27+
- name: Git Checkout
28+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
29+
30+
- name: Setup pnpm
31+
uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
32+
33+
- name: Update pnpm and package.json
34+
id: update-pnpm
35+
run: |
36+
echo "old=$(pnpm --version)" >> $GITHUB_OUTPUT
37+
pnpm self-update
38+
echo "new=$(pnpm --version)" >> $GITHUB_OUTPUT
39+
cat <<< $(jq '.devEngines.packageManager.version = (.packageManager | split("@")[1])' package.json) > package.json
40+
41+
- name: Open pull request
42+
if: steps.update-pnpm.outputs.old != steps.update-pnpm.outputs.new
43+
uses: gr2m/create-or-update-pull-request-action@b65137ca591da0b9f43bad7b24df13050ea45d1b # v1.10.1
44+
# Creates a PR or update the Action's existing PR, or
45+
# no-op if the base branch is already up-to-date.
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
update-pull-request-title-and-body: true
50+
branch: chore/update-pnpm
51+
body: |
52+
Updates pnpm from ${{ steps.update-pnpm.outputs.old }} to version ${{ steps.update-pnpm.outputs.new }}
53+
54+
cc @nodejs/web-infra
55+
56+
Check this workflow's logs at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.
57+
commit-message: "chore: update pnpm to ${{ steps.update-pnpm.outputs.new }}"
58+
labels: fast-track
59+
title: "chore: update pnpm to ${{ steps.update-pnpm.outputs.new }}"
60+
draft: true

0 commit comments

Comments
 (0)