forked from openvinotoolkit/nncf
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (73 loc) · 2.86 KB
/
api_changes_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
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
70
71
72
73
74
75
76
77
name: API changes check
permissions: read-all
on:
pull_request_target:
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:
needs: call-build-api-doc
runs-on: ubuntu-20.04
permissions:
issues: write
steps:
- name: Download built HTML doc as artifact from previous step
uses: alehechka/download-tartifact@1195216b256562056097b175df17b167557f8681 # v2
with:
name: html_doc_artifact
- name: Checkout latest doc_pages branch tip
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
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
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ !(contains(steps.diff.outputs.changed_files, 'differ')) && contains(github.event.pull_request.labels.*.name, 'API') }}
with:
github-token: ${{ secrets.ADD_LABELS_WITH_REST_API }}
script: |
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: "API"
})
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ contains(steps.diff.outputs.changed_files, 'differ') }}
with:
github-token: ${{ secrets.ADD_LABELS_WITH_REST_API }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["API"]
})
- name: Add release label
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
if: ${{ contains(github.event.pull_request.base.ref, 'release_v') }}
with:
github-token: ${{ secrets.ADD_LABELS_WITH_REST_API }}
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["release_target"]
})