-
-
Notifications
You must be signed in to change notification settings - Fork 3
48 lines (45 loc) · 1.33 KB
/
pull_request_dependabot.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
name: Build PR (Dependabot)
on: pull_request_target
jobs:
build:
runs-on: ${{ matrix.os }}
if: ${{ github.actor == 'dependabot[bot]' }}
strategy:
matrix:
node-version: [16.x]
os: [ubuntu-latest]
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Use Node.js ${{ matrix.node_version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node_version }}
- name: npm install, build, and test
run: |
npm install
npm run test
env:
CI: true
- name: Merge PR
if: success()
uses: "actions/github-script@v2"
with:
github-token: "${{ secrets.GH_KEY }}"
script: |
const pullRequest = context.payload.pull_request
const repository = context.repo
await github.pulls.merge({
merge_method: "merge",
owner: repository.owner,
pull_number: pullRequest.number,
repo: repository.repo,
})
- name: Reject PR
if: failure()
uses: peter-evans/close-pull@v1
with:
pull-request-number: ${{github.event.number}}
comment: "Closing PR due to failing tests."
delete-branch: true