-
Notifications
You must be signed in to change notification settings - Fork 144
41 lines (39 loc) · 1.12 KB
/
package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# When a pull request is opened/reopened or when the head branch of the pull request is updated.
on:
[pull_request]
name: Package
jobs:
check:
name: Package distribution file
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Init a git repo
uses: actions/checkout@v4
- name: Checkout PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr checkout ${{ github.event.pull_request.number }}
- name: Node setup
uses: actions/setup-node@v4
with:
node-version: 20
- name: Package
run: |
npm ci
npm test
npm run package
- name: Commit to PR
if: github.actor == 'dependabot[bot]'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global user.name "GitHub Actions"
git add dist/
git commit -m "chore: Update dist" || echo "No changes to commit"
git push
- name: Check git diff
if: github.actor != 'dependabot[bot]'
run: |
git diff --exit-code dist/index.js