-
-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (72 loc) · 2.24 KB
/
update-dist.yaml
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
name: Dependabot PR
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
print-info:
name: Print PR info
runs-on: ubuntu-22.04
steps:
- name: Print some event info
run: |
echo Ref: ${{ github.ref }}
echo Head-Ref: ${{ github.head_ref }}
echo Actor: ${{ github.actor }}
echo Event: ${{ github.event.pull_request }}
auto-approve-pr:
name: Auto approve dependabot PR
runs-on: ubuntu-22.04
if: >
startsWith(github.head_ref, 'dependabot/npm_and_pnpm') &&
github.actor == 'dependabot[bot]'
needs: [print-info]
permissions:
pull-requests: write
steps:
- name: Check out code
uses: actions/[email protected]
with:
ref: ${{ github.head_ref }}
- name: Dependabot metadata
id: dependabot-metadata
uses: dependabot/[email protected]
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Approve a PR
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' }}
run: |
gh pr checkout "$PR_URL"
[ "$(gh pr status --json reviewDecision -q .currentBranch.reviewDecision)" != "APPROVED" ] \
&& gh pr review --approve "$PR_URL" -b "LGTM :rocket:"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
update-dist:
name: Update dist
runs-on: ubuntu-22.04
if: >
startsWith(github.head_ref, 'dependabot/npm_and_pnpm') &&
github.actor == 'dependabot[bot]'
needs: [auto-approve-pr]
permissions:
contents: write
steps:
- name: Check out code
uses: actions/[email protected]
with:
ref: ${{ github.head_ref }}
- name: Setup Node
uses: actions/[email protected]
with:
node-version: '16'
- name: Setup pnpm
run: npm install --location=global pnpm
- name: Install dependencies
run: pnpm install
- name: Update dist
run: pnpm build
- name: Commit new dist
uses: stefanzweifel/[email protected]
with:
file_pattern: dist
commit_message: Build dist