-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (59 loc) · 2.1 KB
/
dep-update-review.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
name: Dependency Update Reviewer
on:
pull_request:
types:
- opened
- synchronize
- reopened
paths:
- "**Cargo.lock"
- "**Cargo.toml"
jobs:
generate-report:
runs-on: ubuntu-latest-xl
name: Comment update review report on PR
env:
MAX_ALLOWED_CHARS: 65536
steps:
- name: checkout
uses: actions/[email protected]
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: checkout base ref
uses: actions/[email protected]
with:
ref: ${{ github.event.pull_request.base.sha }}
path: diem-base
- name: install depdive
run: cargo install depdive --version=0.1.0
- name: Get depdive update report
id: set-update-report
run: |
output="$(depdive update-review paths ./diem-base/ ./)"
echo "${output}"
output="${output//'%'/'%25'}"
output="${output//$'\n'/'%0A'}"
output="${output//$'\r'/'%0D'}"
echo "::set-output name=report::${output}"
length=$(echo ${output} | wc -c)
flag=$(( ${length} < ${MAX_ALLOWED_CHARS} ))
echo "::set-output name=flag::${flag}"
- name: make valid comment
if: ${{ steps.set-update-report.outputs.report && steps.set-update-report.outputs.flag == 1 }}
uses: diem/actions/comment@a5fa31ff2b54a544cd88ac912cda469742592e6c
with:
comment: |
${{ steps.set-update-report.outputs.report }}
tag: update-review-report
delete-older: true
- name: make comment when output too big
if: ${{ steps.set-update-report.outputs.flag == 0 }}
uses: diem/actions/comment@a5fa31ff2b54a544cd88ac912cda469742592e6c
with:
# todo if comment too big, create a gist and post the gist link
comment: |
`This PR contains dependency updates.
However, Depdive update review report exceeds max. characters allowed in a GitHub comment.
Please, run depdive locally or check actions.`
tag: update-review-report
delete-older: true