Skip to content

Commit 7b1ce81

Browse files
committed
Split the dependabot pr workflow into two separate ones
This accomodates the change that workflows triggered by dependabot are now using read-only token (https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/)
1 parent be6db4d commit 7b1ce81

File tree

3 files changed

+50
-46
lines changed

3 files changed

+50
-46
lines changed

.github/workflows/build-pr.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: build-pr
2+
on:
3+
pull_request:
4+
branches:
5+
- master
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
node-version: [10.x, 12.x]
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Use Node.js ${{ matrix.node-version }}
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: ${{ matrix.node-version }}
18+
- name: install and build
19+
run: |
20+
yarn install
21+
yarn run coverage
22+
yarn run build
23+
env:
24+
CI: true
25+
- run: ./node_modules/.bin/codecov -f coverage/*.json

.github/workflows/build.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
- '*'
66
tags-ignore:
77
- 'v*'
8-
pull_request:
9-
branches:
10-
- master
118
jobs:
129
build:
1310
runs-on: ubuntu-latest
Lines changed: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,10 @@
11
name: dependabot-pr
22
on:
3-
pull_request:
4-
branches:
5-
- master
3+
workflow_run:
4+
workflows: ["build-pr", "lint-pr"]
5+
types:
6+
- completed
67
jobs:
7-
build:
8-
name: Build
9-
runs-on: ubuntu-latest
10-
if: github.base_ref == 'master' && github.actor == 'dependabot[bot]'
11-
strategy:
12-
matrix:
13-
node-version: [10.x, 12.x]
14-
steps:
15-
- uses: actions/checkout@v2
16-
- name: Use Node.js ${{ matrix.node-version }}
17-
uses: actions/setup-node@v1
18-
with:
19-
node-version: ${{ matrix.node-version }}
20-
- name: install and build
21-
run: |
22-
yarn install
23-
yarn run coverage
24-
yarn run build
25-
env:
26-
CI: true
27-
288
autoapprove:
299
name: Approve pull request
3010
runs-on: ubuntu-latest
@@ -47,23 +27,25 @@ jobs:
4727
})
4828
core.debug(`Approved pull request #${pr.number}`)
4929
50-
automerge:
51-
name: Merge pull request
52-
runs-on: ubuntu-latest
53-
needs: autoapprove
54-
if: github.base_ref == 'master' && github.actor == 'dependabot[bot]'
55-
steps:
56-
- name: Merge
57-
uses: actions/github-script@v2
58-
with:
59-
github-token: ${{ secrets.GITHUB_TOKEN }}
60-
script: |
61-
const { pull_request: pr, repository: repo } = context.payload
30+
# Handled by GitHub's auto-merge feature
31+
#
32+
# automerge:
33+
# name: Merge pull request
34+
# runs-on: ubuntu-latest
35+
# needs: autoapprove
36+
# if: github.base_ref == 'master' && github.actor == 'dependabot[bot]'
37+
# steps:
38+
# - name: Merge
39+
# uses: actions/github-script@v2
40+
# with:
41+
# github-token: ${{ secrets.GITHUB_TOKEN }}
42+
# script: |
43+
# const { pull_request: pr, repository: repo } = context.payload
6244

63-
core.debug(`Merging pull request #${pr.number}`)
64-
await github.pulls.merge({
65-
owner: repo.owner.login,
66-
repo: repo.name,
67-
pull_number: pr.number
68-
})
69-
core.debug(`Merged pull request #${pr.number}`)
45+
# core.debug(`Merging pull request #${pr.number}`)
46+
# await github.pulls.merge({
47+
# owner: repo.owner.login,
48+
# repo: repo.name,
49+
# pull_number: pr.number
50+
# })
51+
# core.debug(`Merged pull request #${pr.number}`)

0 commit comments

Comments
 (0)