Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Commit 1ba28f8

Browse files
authored
sync: update CI config files (#15)
* add .github/workflows/automerge.yml * update .github/workflows/js-test-and-release.yml Co-authored-by: web3-bot <[email protected]>
1 parent 32de426 commit 1ba28f8

File tree

2 files changed

+88
-5
lines changed

2 files changed

+88
-5
lines changed

.github/workflows/automerge.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
4+
# Automatically merge pull requests opened by web3-bot, as soon as (and only if) all tests pass.
5+
# This reduces the friction associated with updating with our workflows.
6+
7+
on: [ pull_request ]
8+
name: Automerge
9+
10+
jobs:
11+
automerge-check:
12+
if: github.event.pull_request.user.login == 'web3-bot'
13+
runs-on: ubuntu-latest
14+
outputs:
15+
status: ${{ steps.should-automerge.outputs.status }}
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0
20+
- name: Check if we should automerge
21+
id: should-automerge
22+
run: |
23+
for commit in $(git rev-list --first-parent origin/${{ github.event.pull_request.base.ref }}..${{ github.event.pull_request.head.sha }}); do
24+
committer=$(git show --format=$'%ce' -s $commit)
25+
echo "Committer: $committer"
26+
if [[ "$committer" != "[email protected]" ]]; then
27+
echo "Commit $commit wasn't committed by web3-bot, but by $committer."
28+
echo "::set-output name=status::false"
29+
exit
30+
fi
31+
done
32+
echo "::set-output name=status::true"
33+
automerge:
34+
needs: automerge-check
35+
runs-on: ubuntu-latest
36+
# The check for the user is redundant here, as this job depends on the automerge-check job,
37+
# but it prevents this job from spinning up, just to be skipped shortly after.
38+
if: github.event.pull_request.user.login == 'web3-bot' && needs.automerge-check.outputs.status == 'true'
39+
steps:
40+
- name: Wait on tests
41+
uses: lewagon/wait-on-check-action@bafe56a6863672c681c3cf671f5e10b20abf2eaa # v0.2
42+
with:
43+
ref: ${{ github.event.pull_request.head.sha }}
44+
repo-token: ${{ secrets.GITHUB_TOKEN }}
45+
wait-interval: 10
46+
running-workflow-name: 'automerge' # the name of this job
47+
- name: Merge PR
48+
uses: pascalgn/automerge-action@741c311a47881be9625932b0a0de1b0937aab1ae # v0.13.1
49+
env:
50+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
51+
MERGE_LABELS: ""
52+
MERGE_METHOD: "squash"
53+
MERGE_DELETE_BRANCH: true

.github/workflows/js-test-and-release.yml

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1+
# File managed by web3-bot. DO NOT EDIT.
2+
# See https://github.com/protocol/.github/ for details.
3+
14
name: test & maybe release
25
on:
36
push:
47
branches:
5-
- master
8+
- master # with #262 - ${{{ github.default_branch }}}
69
pull_request:
710
branches:
8-
- master
11+
- master # with #262 - ${{{ github.default_branch }}}
912

1013
jobs:
1114

@@ -35,7 +38,10 @@ jobs:
3538
node-version: ${{ matrix.node }}
3639
- uses: ipfs/aegir/actions/cache-node-modules@master
3740
- run: npm run --if-present test:node
38-
- uses: codecov/codecov-action@v1
41+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
42+
with:
43+
directory: ./.nyc_output
44+
flags: node
3945

4046
test-chrome:
4147
needs: check
@@ -47,6 +53,10 @@ jobs:
4753
node-version: lts/*
4854
- uses: ipfs/aegir/actions/cache-node-modules@master
4955
- run: npm run --if-present test:chrome
56+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
57+
with:
58+
directory: ./.nyc_output
59+
flags: chrome
5060

5161
test-chrome-webworker:
5262
needs: check
@@ -58,6 +68,10 @@ jobs:
5868
node-version: lts/*
5969
- uses: ipfs/aegir/actions/cache-node-modules@master
6070
- run: npm run --if-present test:chrome-webworker
71+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
72+
with:
73+
directory: ./.nyc_output
74+
flags: chrome-webworker
6175

6276
test-firefox:
6377
needs: check
@@ -69,6 +83,10 @@ jobs:
6983
node-version: lts/*
7084
- uses: ipfs/aegir/actions/cache-node-modules@master
7185
- run: npm run --if-present test:firefox
86+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
87+
with:
88+
directory: ./.nyc_output
89+
flags: firefox
7290

7391
test-firefox-webworker:
7492
needs: check
@@ -80,6 +98,10 @@ jobs:
8098
node-version: lts/*
8199
- uses: ipfs/aegir/actions/cache-node-modules@master
82100
- run: npm run --if-present test:firefox-webworker
101+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
102+
with:
103+
directory: ./.nyc_output
104+
flags: firefox-webworker
83105

84106
test-electron-main:
85107
needs: check
@@ -91,6 +113,10 @@ jobs:
91113
node-version: lts/*
92114
- uses: ipfs/aegir/actions/cache-node-modules@master
93115
- run: npx xvfb-maybe npm run --if-present test:electron-main
116+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
117+
with:
118+
directory: ./.nyc_output
119+
flags: electron-main
94120

95121
test-electron-renderer:
96122
needs: check
@@ -102,13 +128,17 @@ jobs:
102128
node-version: lts/*
103129
- uses: ipfs/aegir/actions/cache-node-modules@master
104130
- run: npx xvfb-maybe npm run --if-present test:electron-renderer
131+
- uses: codecov/codecov-action@f32b3a3741e1053eb607407145bc9619351dc93b # v2.1.0
132+
with:
133+
directory: ./.nyc_output
134+
flags: electron-renderer
105135

106136
release:
107137
needs: [test-node, test-chrome, test-chrome-webworker, test-firefox, test-firefox-webworker, test-electron-main, test-electron-renderer]
108138
runs-on: ubuntu-latest
109-
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
139+
if: github.event_name == 'push' && github.ref == 'refs/heads/master' # with #262 - 'refs/heads/${{{ github.default_branch }}}'
110140
steps:
111-
- uses: actions/checkout@v2.4.0
141+
- uses: actions/checkout@v2
112142
with:
113143
fetch-depth: 0
114144
- uses: actions/setup-node@v2

0 commit comments

Comments
 (0)