-
Notifications
You must be signed in to change notification settings - Fork 51
42 lines (40 loc) · 1.47 KB
/
diff-schema.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
name: Generate schema diff
on:
push:
branches:
- v1.x/rc
- v1.x/master
- v2.x/rc
- v2.x/master
- v3.x/rc
- v3.x/master
workflow_dispatch:
inputs:
FROM_COMMIT:
description: 'Specify commit, branch or tag to diff from'
required: false
TO_COMMIT:
description: 'Specify commit, branch or tag to diff to'
required: false
jobs:
diff:
runs-on: ubuntu-latest
steps:
- name: '[Prep 1] Checkout'
uses: actions/checkout@v2
- name: '[Prep 2] Setup Node'
uses: actions/setup-node@v2
with:
node-version: 18
- name: '[Prep 3] Get to version'
run: node -e "const currentVersion = require('manifest.json.template').version; console.log('${{ github.event.inputs.TO_COMMIT }}'.length > 0 ? 'TO=${{ github.event.inputs.TO_COMMIT }}' : 'TO='+currentVersion);" >> $GITHUB_ENV
- name: '[Prep 4] Get from version'
run: node -e "if ('${{ github.event.inputs.FROM_COMMIT }}'.length > 0) { console.log('FROM=${{ github.event.inputs.FROM_COMMIT }}') } else { let parts = envs.TO_COMMIT.split('.'); parts[1]--; console.log('FROM='+parts.join('.')); }" >> $GITHUB_ENV
- name: '[Build] Make diff'
run: git diff ${{ envs.FROM }} ${{ envs.TO }} -- schemas > schemas.diff
- name: '[Upload]'
uses: actions/upload-artifact@v3
with:
name: schemas.diff
path: schemas.diff
if-no-files-found: error