-
Notifications
You must be signed in to change notification settings - Fork 18
66 lines (59 loc) · 2.22 KB
/
check-admin-ui-api.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: Admin UI API Check
on:
pull_request:
paths:
- "backend/**"
- ".github/workflows/check-admin-ui-api.yml"
jobs:
main:
runs-on: ubuntu-latest
steps:
- name: Check out the code
uses: actions/checkout@v3
with:
fetch-depth: 2
- name: Install GraphQL Inspector
run: |
npm install \
@graphql-inspector/[email protected] \
@graphql-inspector/[email protected] \
@graphql-inspector/[email protected] \
@graphql-inspector/[email protected]
- name: Check for changes to the APIs the admin UI integration uses
id: graphql_inspector
run: |
npx graphql-inspector diff \
--rule .github/workflows/check-admin-ui-api/rule.js \
--onComplete .github/workflows/check-admin-ui-api/onComplete.js \
git:${{ github.event.pull_request.base.sha }}:frontend/src/schema.graphql \
git:${{ github.event.pull_request.head.sha }}:frontend/src/schema.graphql \
| tee >( \
grep -v ^::set-output \
| sed -e 's/\[\(log\|success\|info\|error\|warn\)\] //' \
> diff \
)
- name: Read diff output
id: diff_output
uses: juliangruber/read-file-action@v1
with:
path: diff
trim: true
if: steps.graphql_inspector.outputs.changes == 'true'
- name: Hide previous comments made by this workflow
uses: int128/hide-comment-action@v1
with:
# We have to specify an empty author-filter here so that this step doesn't try to remove
# the deployment comments we create in another step (or any other comments by github-actions
# for that matter).
authors:
starts-with: "<!-- admin-ui-api-check -->"
- name: Add a comment when there are relevant changes
uses: int128/comment-action@v1
with:
post: |
<!-- admin-ui-api-check -->
🚨🚨🚨 This PR changes APIs used by the Opencast Admin UI integration 🚨🚨🚨
```
${{ steps.diff_output.outputs.content }}
```
if: steps.graphql_inspector.outputs.changes == 'true'