-
-
Notifications
You must be signed in to change notification settings - Fork 144
65 lines (50 loc) · 1.68 KB
/
check-depgraph.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
name: Check Depgraph
on:
pull_request:
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
check-depgraph:
runs-on: ubuntu-latest
permissions:
# Needed in order to leave comments on pull requests.
pull-requests: 'write'
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v3
- name: Install cargo-depgraph
uses: baptiste0928/[email protected]
with:
crate: cargo-depgraph
- name: Install graphviz
run: sudo apt update && sudo apt install -y graphviz
- name: Generate new depgraph
run: cargo depgraph --workspace-only | tred | dot -Tsvg -o assets/depgraph.svg
- name: Check depgraph diff
run: git diff --exit-code assets/depgraph.svg > assets/depgraph.patch
- name: Create comment file
if: ${{ failure() }}
run: |
echo "It looks like this pull request changed the workspace structure. \
Please replace \`assets/depgraph.svg\` with the following text:
<details>
<summary>depgraph.svg (Don't forget the trailing newline)</summary>
\`\`\`html
$(cat assets/depgraph.svg)
\`\`\`
</details>
For reference, here is a diff against the old \`depgraph.svg\`:
<details>
\`\`\`patch
$(cat assets/depgraph.patch)
\`\`\`
</details>" >> pr-comment.txt
- name: Create pull request comment
uses: marocchino/sticky-pull-request-comment@v2
if: ${{ failure() }}
with:
recreate: true
header: depgraph
path: pr-comment.txt