-
Notifications
You must be signed in to change notification settings - Fork 0
66 lines (59 loc) · 1.88 KB
/
workflow.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
name: Exemplar JS CI
on:
workflow_dispatch:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v2
with:
node-version: 16
cache: "npm"
- run: npm ci --no-scripts
- run: npm run bootstrap
- run: npm run in-all-packages lint
- run: npm run in-all-packages build
- uses: actions/upload-artifact@v3
with:
path: packages/**/build
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- uses: actions/setup-node@v2
with:
node-version: 16
cache: "npm"
- run: npm ci --no-scripts
- run: npm run bootstrap
- uses: actions/download-artifact@v3
with:
name: artifact
path: packages
- run: npm run in-all-packages test:ci
- uses: actions/github-script@v6
if: github.event_name == 'pull_request'
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const {getCoverageString} = require('./packages/scripts/coverageUtils.cjs')
const { issue: { number: issue_number }, repo: { owner, repo }, payload: { pull_request } } = context;
const compared = await github.rest.repos.compareCommits({
base: pull_request.base.sha,
head: pull_request.head.sha,
owner,
repo
})
const fileDiff = compared.data.files.map((file) => file.filename)
const coverageString = getCoverageString(fileDiff)
github.rest.issues.createComment({ issue_number, owner, repo, body: coverageString });