-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 1.79 KB
/
dependabot-auto-merge.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
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
name: Test and AutoMerge PRs
on:
pull_request:
types: [opened, synchronize, edit]
branches: [master]
permissions:
# This is needed to approve the PR
pull-requests: write
# This is needed to merge the PR https://github.com/cli/cli/issues/6695#issuecomment-1348430969
contents: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Install node.js
uses: actions/setup-node@v4
with:
node-version: 'latest'
cache: 'npm'
- name: Cache node modules
id: cache-nodemodules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# caching node_modules
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: npm ci
- name: Check prettier
run: npm run prettier
- name: Build site
run: npm run build
auto-merge-dependabot:
needs: [build]
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- name: Approve the PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Auto merge the PR
run: gh pr merge --rebase --auto "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}