Skip to content

Commit 93e742c

Browse files
authored
ci: add update-pnpm action (#1147)
1 parent cf6e157 commit 93e742c

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

‎.github/workflows/update-pnpm.yml‎

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Update pnpm
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 0 1 * *'
7+
8+
permissions:
9+
contents: write
10+
pull-requests: write
11+
12+
jobs:
13+
pnpm-update:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Harden Runner
18+
uses: step-security/harden-runner@e14015d583714f6e62063499dc959a02595150a1 # v2.21.1
19+
with:
20+
egress-policy: block
21+
allowed-endpoints: >
22+
github.com:443
23+
api.github.com:443
24+
objects.githubusercontent.com:443
25+
registry.npmjs.org:443
26+
27+
- name: Git Checkout
28+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
29+
with:
30+
persist-credentials: false
31+
32+
- name: Setup pnpm
33+
uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
34+
35+
# `pnpm self-update` also updates the `packageManager` field
36+
# in package.json to the newly installed version.
37+
- name: Update pnpm
38+
id: update-pnpm
39+
run: |
40+
echo "old=$(pnpm --version)" >> $GITHUB_OUTPUT
41+
pnpm self-update
42+
echo "new=$(pnpm --version)" >> $GITHUB_OUTPUT
43+
44+
- name: Open pull request
45+
if: steps.update-pnpm.outputs.old != steps.update-pnpm.outputs.new
46+
uses: gr2m/create-or-update-pull-request-action@b65137ca591da0b9f43bad7b24df13050ea45d1b # v1.10.1
47+
# Creates a PR or update the Action's existing PR, or
48+
# no-op if the base branch is already up-to-date.
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
with:
52+
update-pull-request-title-and-body: true
53+
branch: chore/update-pnpm
54+
body: |
55+
Updates pnpm from ${{ steps.update-pnpm.outputs.old }} to ${{ steps.update-pnpm.outputs.new }}
56+
57+
cc @nodejs/web-infra
58+
59+
Check this workflow's logs at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.
60+
commit-message: 'meta: update pnpm from ${{ steps.update-pnpm.outputs.old }} to ${{ steps.update-pnpm.outputs.new }}'
61+
title: 'meta: update pnpm from ${{ steps.update-pnpm.outputs.old }} to ${{ steps.update-pnpm.outputs.new }}'
62+
draft: true

0 commit comments

Comments
 (0)