1
- name : pr-check
1
+ name : Swagger notiication
2
2
3
3
on :
4
- pull_request :
5
- branches : [ swagger_docs ]
4
+ push :
5
+ branches :
6
+ - swagger_docs
6
7
7
8
workflow_dispatch :
9
+ branches :
10
+ - swagger_docs
8
11
9
12
jobs :
13
+ changes :
14
+ runs-on : ubuntu-latest
15
+ timeout-minutes : 5
16
+ outputs :
17
+ json-file : ${{ steps.json.outputs.changes }}
18
+ steps :
19
+ - uses : actions/checkout@v4
20
+ with :
21
+ fetch-depth : 2
22
+ - uses : dorny/paths-filter@v3
23
+ id : json
24
+ with :
25
+ base : ${{ github.ref }}
26
+ filters : |
27
+ latest:
28
+ - 'latest.json'
29
+ staging:
30
+ - 'staging.json'
31
+ production:
32
+ - 'production.json'
33
+
10
34
diff :
11
35
name : OpenAPI diff
12
36
runs-on : ubuntu-latest
13
37
timeout-minutes : 5
38
+ # if: ${{ needs.changes.outputs.json-file != '[]' && needs.changes.outputs.json-file != '' }}
39
+ strategy :
40
+ fail-fast : false
41
+ matrix :
42
+ changed-apis : ${{ fromJSON(needs.changes.outputs.json-file) }}
14
43
steps :
15
44
- name : Check out head branch
16
- uses : actions/checkout@v3
45
+ uses : actions/checkout@v4
17
46
with :
18
47
path : head
48
+
19
49
- name : Check out swagger_docs branch
20
- uses : actions/checkout@v3
50
+ uses : actions/checkout@v4
21
51
with :
22
52
ref : swagger_docs
23
53
path : base
54
+ fetch-depth : 2
55
+
56
+ - name : Check out swagger_docs branch
57
+ run : cd base && git checkout HEAD^
58
+
24
59
- name : Run OpenAPI Diff (from HEAD revision)
25
60
uses : docker://openapitools/openapi-diff:latest
26
61
with :
27
- args : --json diff.json base/latest.json head/latest.json
62
+ args : --json diff.json --text diff.txt base/${JSON_FILE}.json head/${JSON_FILE}.json
63
+ env :
64
+ JSON_FILE : ${{ matrix.changed-apis }}
28
65
- name : print diff
29
- run : cat diff.json
66
+ run : |
67
+ slack.sh ${{ matrix.changed-apis }}
68
+ env :
69
+ SLACK_WEBHOOK : ${{ secrets.API_SLACK_WEBHOOK_URL }}
70
+
71
+ # - name: Upload to slack step
72
+ # uses: adrey/slack-file-upload-action@master
73
+ # with:
74
+ # token: ${{ secrets.SLACK_BOT_TOKEN }}
75
+ # path: diff.json
76
+ # channel: fx_api_changes
0 commit comments