-
Notifications
You must be signed in to change notification settings - Fork 583
64 lines (53 loc) · 1.92 KB
/
diff-javadoc.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
name: Diff Javadoc
on:
pull_request:
jobs:
build:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Make diff directory
run: mkdir ~/diff
- name: Checkout PR branch
uses: actions/checkout@v4.1.1
with:
fetch-depth: 2
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v4.1.0
with:
java-version: 17
distribution: temurin
cache: gradle
- name: Generate docs for PR branch
run: ./gradlew kotlindoc
- name: Move branch docs to diff directory
run: mv build ~/diff/modified
- name: Checkout main
uses: actions/checkout@v4.1.1
with:
ref: ${{ github.base_ref }}
- name: Generate docs for main
run: ./gradlew kotlindoc
- name: Move main docs to diff directory
run: mv build ~/diff/original
- name: Get diff between main and Branch docs
run: >
`# Recursively diff directories, including new files, git style, with 3 lines of context`
diff -wEburN ~/diff/original ~/diff/modified
`# Remove the first line and new file signifier of the output`
| tail -n +2
`# Replace the diff new file signifier with the end and start of a new codeblock`
| sed "s/^diff.*$/\`\`\`\\n\`\`\`diff/g"
`# Add a collapsable block, summary, and start the first code block on the first line`
| sed "1s/^/<details>\\n<summary>Javadoc Changes:<\/summary>\\n\\n\`\`\`diff\\n/"
`# Close the final code block and close the collapsable on the final line`
| sed "$ s/$/\\n\`\`\`\\n<\/details>/"
`# Write to diff.md for later`
> diff.md
- name: Add comment
continue-on-error: true
uses: mshick/add-pr-comment@a65df5f64fc741e91c59b8359a4bc56e57aaf5b1
with:
message-path: diff.md