-
Notifications
You must be signed in to change notification settings - Fork 654
69 lines (58 loc) · 2.3 KB
/
diff.yaml
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: OpenConfig YANG Diff
on:
pull_request:
branches: [ master ]
jobs:
build:
name: Backward Incompatibility Check
runs-on: ubuntu-latest
steps:
- name: Install go
uses: actions/setup-go@v2
with:
go-version: '1.20'
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install openconfig-ci CLI
run: |
go install github.com/openconfig/models-ci/openconfig-ci@742647c
- name: Make sure all backward-incompatible changes are covered by version changes.
id: check
run: |
readonly HEAD=${{ github.event.pull_request.head.sha }}
readonly BASE="$(git merge-base origin/master "${HEAD}")"
BASEREPODIR=public_base
mkdir -p "${BASEREPODIR}/release"
git checkout "${BASE}"
cp -r release/models "${BASEREPODIR}/release"
cp -r third_party "${BASEREPODIR}"
git checkout "${HEAD}"
oldroot="${BASEREPODIR}"
newroot=.
oldfiles=$(find "${oldroot}"/release/models -name '*.yang' | tr '\n' ',')
newfiles=$(find "${newroot}"/release/models -name '*.yang' | tr '\n' ',')
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "leafchanges<<$EOF" >> "$GITHUB_ENV"
openconfig-ci diff --github-comment --oldp "${oldroot}/third_party" --oldfiles "${oldfiles}" --newp "${newroot}/third_party" --newfiles "${newfiles}" >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
openconfig-ci diff --disallowed-incompats --oldp "${oldroot}/third_party" --oldfiles "${oldfiles}" --newp "${newroot}/third_party" --newfiles "${newfiles}"
- name: Find Comment
if: always()
uses: peter-evans/find-comment@v2
id: fc
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: -----------List of all YANG node changes-----------
- name: Create or update comment
if: always()
uses: peter-evans/create-or-update-comment@v3
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
\#\# -----------List of all YANG node changes-----------
${{ env.leafchanges }}
edit-mode: replace