Skip to content

Commit cf3d281

Browse files
committed
Update package workflow to run on PRs
- Auto-update dist for dependabot PRs - Validate dist is up-to-date for contributor PRs - Support PRs from forks
1 parent bef7b29 commit cf3d281

1 file changed

Lines changed: 19 additions & 14 deletions

File tree

.github/workflows/package.yml

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,35 @@
1-
on:
2-
push:
3-
branches:
4-
- master
5-
61
name: Package
72

8-
permissions:
9-
contents: write
3+
on:
4+
pull_request:
105

116
jobs:
12-
check:
7+
build:
138
name: Package distribution file
149
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
pull-requests: read
1513
steps:
1614
- name: Checkout
17-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1816
with:
19-
ref: master
17+
repository: ${{ github.event.pull_request.head.repo.full_name }}
18+
ref: ${{ github.event.pull_request.head.ref }}
19+
token: ${{ secrets.GITHUB_TOKEN }}
2020
- name: Package
2121
run: |
2222
npm ci
23-
npm test
24-
npm run all
25-
- name: Commit
23+
npm run build
24+
npm run pack
25+
- name: Commit to PR
26+
if: github.actor == 'dependabot[bot]'
2627
run: |
2728
git config --global user.name "GitHub Actions"
2829
git add dist/
2930
git commit -m "(chore) updating dist" || echo "No changes to commit"
30-
git push origin HEAD:master
31+
git push
32+
- name: Check dist is up-to-date
33+
if: github.actor != 'dependabot[bot]'
34+
run: |
35+
git diff --exit-code dist/

0 commit comments

Comments
 (0)