Skip to content

Commit bba6f17

Browse files
committed
Add pgk.pr.new action script
1 parent 4ded487 commit bba6f17

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

.github/workflows/pr-pkg-new.yml

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Publish Approved Pull Requests
2+
on:
3+
pull_request_review:
4+
types: [submitted]
5+
6+
jobs:
7+
check:
8+
# First, trigger a permissions check on the user approving the pull request.
9+
if: github.event.review.state == 'approved'
10+
runs-on: ubuntu-latest
11+
outputs:
12+
has-permissions: ${{ steps.checkPermissions.outputs.require-result }}
13+
steps:
14+
- name: Check permissions
15+
id: checkPermissions
16+
uses: actions-cool/check-user-permission@v2
17+
with:
18+
# In this example, the approver must have the write access
19+
# to the repository to trigger the package preview.
20+
require: "write"
21+
22+
publish:
23+
needs: check
24+
# Publish the preview package only if the permissions check passed.
25+
if: needs.check.outputs.has-permissions == 'true'
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout code
29+
uses: actions/checkout@v4
30+
31+
- run: corepack enable
32+
- uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
36+
- name: Install dependencies
37+
run: yarn
38+
39+
- name: Build module
40+
run: yarn dev:prepare && yarn prepack
41+
42+
- name: Publish PR
43+
run: npx pkg-pr-new publish

0 commit comments

Comments
 (0)