-
Notifications
You must be signed in to change notification settings - Fork 0
178 lines (171 loc) · 6.96 KB
/
dep-summaries.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
name: Dependency Notifier
on:
pull_request:
types:
- opened
- synchronize
#pull_request_review:
# Should we enforce reviews in the future, then re-enable this.
# types:
# - submitted
# - dismissed
push:
branches:
- auto
jobs:
calc-summaries:
runs-on: ubuntu-latest
name: Calculate dependency summary changes
if: ${{ github.event_name == 'push' || github.actor != 'bors-libra' }}
outputs:
lsr-summary-diff: ${{ steps.verify-lsr.outputs.diff }}
lec-summary-diff: ${{ steps.verify-lec.outputs.diff }}
release-summary-diff: ${{ steps.verify-release.outputs.diff }}
dep-auditors-list: ${{ steps.dep-auditors.outputs.list }}
steps:
- name: checkout
uses: actions/checkout@v2
if: ${{ startsWith(github.event_name, 'pull_request') }}
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: fetch base ref
id: fetch-base-ref
uses: diem/actions/pr-base-ref@faa14430e68d54a269628f385e69a207e4e413d5
if: ${{ startsWith(github.event_name, 'pull_request') }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: checkout base ref
uses: actions/checkout@v2
if: ${{ startsWith(github.event_name, 'pull_request') }}
with:
ref: ${{ steps.fetch-base-ref.outputs.ref }}
path: libra-base
- name: checkout
uses: actions/checkout@v2
if: ${{ github.event_name == 'push' }}
with:
ref: ${{ github.event.after }}
- name: checkout base ref
uses: actions/checkout@v2
if: ${{ github.event_name == 'push' }}
with:
ref: ${{ github.event.before }}
path: libra-base
- name: generate new summaries
run: |
set +e
cargo x generate-summaries
- name: generate base summaries
run: |
set +e
cd libra-base
cargo x generate-summaries
# TODO (sunshowers): add key-manager TCB
- name: diff LSR summary
id: verify-lsr
run: |
output="$(cargo x diff-summary libra-base/target/summaries/summary-lsr.toml target/summaries/summary-lsr.toml)"
echo "${output}"
output="${output//'%'/'%25'}"
output="${output//$'\n'/'%0A'}"
output="${output//$'\r'/'%0D'}"
echo "::set-output name=diff::${output}"
- name: diff LEC summary
id: verify-lec
run: |
output="$(cargo x diff-summary libra-base/target/summaries/summary-lec.toml target/summaries/summary-lec.toml)"
echo "${output}"
output="${output//'%'/'%25'}"
output="${output//$'\n'/'%0A'}"
output="${output//$'\r'/'%0D'}"
echo "::set-output name=diff::${output}"
- name: diff release summary
id: verify-release
run: |
output="$(cargo x diff-summary libra-base/target/summaries/summary-release.toml target/summaries/summary-release.toml)"
echo "${output}"
output="${output//'%'/'%25'}"
output="${output//$'\n'/'%0A'}"
output="${output//$'\r'/'%0D'}"
echo "::set-output name=diff::${output}"
- name: read dep-auditors list
id: dep-auditors
run: |
output=$(cat ./.github/dep-auditors.json | jq -r 'join(",")')
echo "::set-output name=list::${output}"
# requires-dep-audit-review:
# runs-on: ubuntu-latest
# name: Require review for TCB dep summary changes.
# if: ${{ github.event_name == 'push' || github.actor != 'bors-libra' }}
# needs: calc-summaries
# steps:
# - name: require dep-audit review if TCB deps changed
# if: ${{ needs.calc-summaries.outputs.lsr-summary-diff || needs.calc-summaries.lec-summary-diff }}
# uses: diem/actions/require-review@faa14430e68d54a269628f385e69a207e4e413d5
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# users: ${{ needs.calc-summaries.outputs.dep-auditors-list }}
annotate-pr:
runs-on: ubuntu-latest
name: Annotate PR with when summaries change
if: ${{ github.actor != 'bors-libra' && github.event_name == 'pull_request' }}
needs: calc-summaries
steps:
- name: annotate PR with LSR diff
if: ${{ needs.calc-summaries.outputs.lsr-summary-diff }}
uses: diem/actions/comment@faa14430e68d54a269628f385e69a207e4e413d5
with:
comment: |
**LSR dependency change summary**:
```
${{ needs.calc-summaries.outputs.lsr-summary-diff }}
```
tag: lsr-summary
delete-older: true
- name: annotate PR with LEC diff
if: ${{ needs.calc-summaries.outputs.lec-summary-diff }}
uses: diem/actions/comment@faa14430e68d54a269628f385e69a207e4e413d5
with:
comment: |
**LEC dependency change summary**:
```
${{ needs.calc-summaries.outputs.lec-summary-diff }}
```
tag: lec-summary
delete-older: true
- name: annotate PR with release diff
if: ${{ needs.calc-summaries.outputs.release-summary-diff }}
uses: diem/actions/comment@faa14430e68d54a269628f385e69a207e4e413d5
with:
comment: |
**release binaries dependency change summary**:
```
${{ needs.calc-summaries.outputs.release-summary-diff }}
```
tag: release-summary
delete-older: true
- name: label PR if TCB changed
if: ${{ needs.calc-summaries.outputs.lsr-summary-diff || needs.calc-summaries.outputs.lec-summary-diff }}
uses: diem/actions/labels@faa14430e68d54a269628f385e69a207e4e413d5
with:
add: tcb-deps-changed
- name: label PR if tracked deps changed
if: ${{ needs.calc-summaries.outputs.lsr-summary-diff || needs.calc-summaries.outputs.lec-summary-diff || needs.calc-summaries.outputs.release-summary-diff }}
uses: diem/actions/labels@faa14430e68d54a269628f385e69a207e4e413d5
with:
add: deps-changed
- name: unlabel PR if TCB changed
if: ${{ !needs.calc-summaries.outputs.lsr-summary-diff && !needs.calc-summaries.outputs.lec-summary-diff }}
uses: diem/actions/labels@faa14430e68d54a269628f385e69a207e4e413d5
with:
remove: tcb-deps-changed
- name: unlabel PR if tracked deps changed
if: ${{ !needs.calc-summaries.outputs.lsr-summary-diff && !needs.calc-summaries.outputs.lec-summary-diff && !needs.calc-summaries.outputs.release-summary-diff }}
uses: diem/actions/labels@faa14430e68d54a269628f385e69a207e4e413d5
with:
remove: deps-changed
- name: request dep-audit review if TCB deps changed
uses: diem/actions/request-review@faa14430e68d54a269628f385e69a207e4e413d5
if: ${{ needs.calc-summaries.outputs.lsr-summary-diff || needs.calc-summaries.outputs.lec-summary-diff }}
with:
users: ${{ needs.calc-summaries.outputs.dep-auditors-list }}