-
Notifications
You must be signed in to change notification settings - Fork 294
69 lines (61 loc) · 2.45 KB
/
api_changes_check.yml
File metadata and controls
69 lines (61 loc) · 2.45 KB
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
name: API changes check
permissions: read-all
on:
pull_request:
branches:
- develop
env:
API_DOC_HTML_ROOT_RELATIVE_PATH: autoapi
concurrency:
group: ci-${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true
jobs:
call-build-api-doc:
uses: ./.github/workflows/build_html_doc.yml
with:
ref: "refs/pull/${{ github.event.number }}/merge"
compare-api-doc-with-develop:
timeout-minutes: 30
needs: call-build-api-doc
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Download built HTML doc as artifact from previous step
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: html_doc_artifact
- run: |
tar -xvf artifact.tar
rm artifact.tar
shell: 'bash'
- name: Checkout latest doc_pages branch tip
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
ref: doc_pages
path: previous_doc_state
- name: Get changed file names in API doc path
id: diff
run: |
cd "html_build/html/$API_DOC_HTML_ROOT_RELATIVE_PATH"
CHANGED_FILES=$(find . -name "*.html" -exec diff -qrBZ {} "$GITHUB_WORKSPACE/previous_doc_state/$API_DOC_HTML_ROOT_RELATIVE_PATH/{}" \;)
echo "${CHANGED_FILES}"
CHANGED_FILES=$(echo "$CHANGED_FILES" | tr '\n' ' ')
echo "changed_files=${CHANGED_FILES}" >> "$GITHUB_OUTPUT"
- name: Add label
if: ${{ contains(steps.diff.outputs.changed_files, 'differ') }}
run: |
echo '{"pr_number": "${{ github.event.pull_request.number }}", "action": "add"}' > api_status.json
- name: Remove label
if: ${{ !(contains(steps.diff.outputs.changed_files, 'differ')) && contains(github.event.pull_request.labels.*.name, 'API') }}
run: |
echo '{"pr_number": "${{ github.event.pull_request.number }}", "action": "remove"}' > api_status.json
- name: No change label
if: ${{ !(contains(steps.diff.outputs.changed_files, 'differ')) && !contains(github.event.pull_request.labels.*.name, 'API') }}
run: |
echo '{"pr_number": "${{ github.event.pull_request.number }}", "action": "none"}' > api_status.json
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a #v7.0.1
with:
name: api_status
path: api_status.json