-
Notifications
You must be signed in to change notification settings - Fork 895
75 lines (71 loc) · 2.76 KB
/
check-changeset.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
69
70
71
72
73
74
75
name: Check Changeset
on:
pull_request:
branches:
- master
env:
GITHUB_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
GITHUB_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }}
jobs:
check_changeset:
name: Check changeset vs changed files
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
with:
# This makes Actions fetch all Git history so check_changeset script can diff properly.
fetch-depth: 0
- name: Set up Node (16)
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Yarn install
run: yarn
- name: Run changeset script
# pull master so changeset can diff against it
run: |
git pull -f --no-rebase origin master:master
yarn ts-node-script scripts/ci/check_changeset.ts
id: check-changeset
- name: Print changeset checker output
run: echo "${{steps.check-changeset.outputs.CHANGESET_ERROR_MESSAGE}}"
- name: Print blocking failure status
run: echo "${{steps.check-changeset.outputs.BLOCKING_FAILURE}}"
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
issue-number: ${{github.event.number}}
body-includes: Changeset File Check
- name: Create comment (missing packages)
if: ${{!steps.fc.outputs.comment-id && steps.check-changeset.outputs.CHANGESET_ERROR_MESSAGE}}
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{github.event.number}}
body: |
### Changeset File Check :warning:
${{steps.check-changeset.outputs.CHANGESET_ERROR_MESSAGE}}
- name: Update comment (missing packages)
if: ${{steps.fc.outputs.comment-id}}
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{steps.fc.outputs.comment-id}} && steps.check-changeset.outputs.CHANGESET_ERROR_MESSAGE}}
edit-mode: replace
body: |
### Changeset File Check :warning:
${{steps.check-changeset.outputs.CHANGESET_ERROR_MESSAGE}}
- name: Update comment (no missing packages)
if: ${{steps.fc.outputs.comment-id && !steps.check-changeset.outputs.CHANGESET_ERROR_MESSAGE}}
uses: peter-evans/create-or-update-comment@v1
with:
comment-id: ${{steps.fc.outputs.comment-id}}
edit-mode: replace
body: |
### Changeset File Check :white_check_mark:
- No modified packages are missing from the changeset file.
- No changeset formatting errors detected.
# Don't want it to throw before editing the comment.
- name: Fail if checker script logged a blocking failure
if: ${{steps.check-changeset.outputs.BLOCKING_FAILURE == 'true'}}
run: exit 1