|
| 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 | + workflow_dispatch: |
| 11 | + schedule: |
| 12 | + - cron: '0 0 1 * *' |
| 13 | + |
| 14 | +permissions: |
| 15 | + contents: write |
| 16 | + pull-requests: write |
| 17 | + |
| 18 | +jobs: |
| 19 | + update-pnpm: |
| 20 | + runs-on: ubuntu-latest |
| 21 | + |
| 22 | + steps: |
| 23 | + - name: Harden Runner |
| 24 | + uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 |
| 25 | + with: |
| 26 | + egress-policy: audit |
| 27 | + |
| 28 | + - name: Git Checkout |
| 29 | + uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 |
| 30 | + |
| 31 | + - name: Setup pnpm |
| 32 | + uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 |
| 33 | + |
| 34 | + - name: Update pnpm and package.json |
| 35 | + id: update-pnpm |
| 36 | + run: | |
| 37 | + echo "old=$(pnpm --version)" >> $GITHUB_OUTPUT |
| 38 | + pnpm self-update |
| 39 | + echo "new=$(pnpm --version)" >> $GITHUB_OUTPUT |
| 40 | + cat <<< $(jq '.devEngines.packageManager.version = (.packageManager | split("@")[1])' package.json) > package.json |
| 41 | +
|
| 42 | + - name: Open pull request |
| 43 | + if: steps.update-pnpm.outputs.old != steps.update-pnpm.outputs.new |
| 44 | + uses: gr2m/create-or-update-pull-request-action@b65137ca591da0b9f43bad7b24df13050ea45d1b # v1.10.1 |
| 45 | + # Creates a PR or update the Action's existing PR, or |
| 46 | + # no-op if the base branch is already up-to-date. |
| 47 | + env: |
| 48 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 49 | + with: |
| 50 | + update-pull-request-title-and-body: true |
| 51 | + branch: chore/update-pnpm |
| 52 | + body: | |
| 53 | + Updates pnpm from ${{ steps.update-pnpm.outputs.old }} to ${{ steps.update-pnpm.outputs.new }} |
| 54 | +
|
| 55 | + cc @nodejs/web-infra |
| 56 | +
|
| 57 | + Check this workflow's logs at ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}. |
| 58 | + commit-message: 'meta: update pnpm from ${{ steps.update-pnpm.outputs.old }} to ${{ steps.update-pnpm.outputs.new }}' |
| 59 | + title: 'meta: update pnpm from ${{ steps.update-pnpm.outputs.old }} to ${{ steps.update-pnpm.outputs.new }}' |
| 60 | + draft: true |
0 commit comments