-
-
Notifications
You must be signed in to change notification settings - Fork 46
37 lines (32 loc) · 1.19 KB
/
update-api-specs-check.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
name: Update API Specs Check
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
update-api-specs-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v41
with:
since_last_remote_commit: true
files_separator: ","
files: static/api/v1.yaml,static/api/v2.yaml
- name: Fail workflow if api specs has updated - comment err msg on PR
if: steps.changed-files.outputs.only_changed == 'true' && github.event_name == 'pull_request'
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh pr comment $PR_NUMBER --body 'Avoid updating the api-specs directly. They will be overwritten.' && exit 1
- name: Fail workflow if api specs has updated - echo err msg
if: steps.changed-files.outputs.only_changed == 'true' && github.event_name != 'pull_request'
run: echo 'Avoid updating the api-specs directly. They will be overwritten.' && exit 1