Skip to content

Commit ec4e1e8

Browse files
Merge pull request #30 from usefulness/more_pr_checks
2 parents 2ef2920 + 4fae524 commit ec4e1e8

File tree

5 files changed

+89
-10
lines changed

5 files changed

+89
-10
lines changed

.github/workflows/after_merge.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ jobs:
2323
with:
2424
old-file-path: sample-apk.apk
2525
new-file-path: sample-apk.apk
26+
27+
- uses: actions/upload-artifact@v2
28+
with:
29+
name: diffuse-output
30+
path: ${{ steps.diffuse.outputs.diff-file }}

.github/workflows/main.yml

Lines changed: 66 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
jobs:
55
test-apk:
66
runs-on: ubuntu-latest
7-
name: Run diffuse action
7+
name: Run diffuse action (part 1)
88
steps:
99
- uses: actions/checkout@v2
1010

@@ -30,18 +30,17 @@ jobs:
3030
id: find_comment
3131
with:
3232
issue-number: ${{ github.event.pull_request.number }}
33-
body-includes: diffuse-smoke-test
33+
body-includes: diffuse-smoke-test-1
3434

3535
- uses: peter-evans/create-or-update-comment@v1
36-
if: ${{ steps.diffuse.outputs.diff-raw != null || steps.find_comment.outputs.comment-id != null }}
3736
with:
3837
body: |
39-
### diffuse-smoke-test
38+
### diffuse-smoke-test-1
4039
4140
`steps.diffuse.outputs.diff-gh-comment:`
4241
${{ steps.diffuse.outputs.diff-gh-comment }}
4342
44-
`steps.diffuse.outputs.summary`
43+
`steps.diffuse.outputs.summary`
4544
```
4645
${{ steps.diffuse.outputs.summary }}
4746
```
@@ -55,14 +54,74 @@ jobs:
5554
```
5655
${{ steps.diffuse.outputs.dex }}
5756
```
57+
edit-mode: replace
58+
comment-id: ${{ steps.find_comment.outputs.comment-id }}
59+
issue-number: ${{ github.event.pull_request.number }}
60+
token: ${{ secrets.GITHUB_TOKEN }}
61+
62+
- uses: actions/upload-artifact@v2
63+
with:
64+
name: diffuse-output-1
65+
path: ${{ steps.diffuse.outputs.diff-file }}
66+
67+
test-apk-2:
68+
runs-on: ubuntu-latest
69+
name: Run diffuse action (part 2)
70+
steps:
71+
- uses: actions/checkout@v2
72+
73+
- name: set up JDK
74+
uses: actions/setup-java@v1
75+
with:
76+
java-version: 11
77+
78+
- name: Get very old version of Andorid Auto app for test purposes
79+
run: wget "https://github.com/usefulness/storage/raw/master/audroid-auto-very-old.apk" -O very-old-apk.apk
80+
81+
- name: Get new version of Andorid Auto app for test purposes
82+
run: wget "https://github.com/usefulness/storage/raw/master/android-auto-new.apk" -O new-apk.apk
83+
84+
- id: diffuse
85+
uses: ./
86+
with:
87+
old-file-path: very-old-apk.apk
88+
new-file-path: new-apk.apk
89+
debug: true
90+
91+
- uses: peter-evans/find-comment@v1
92+
id: find_comment
93+
with:
94+
issue-number: ${{ github.event.pull_request.number }}
95+
body-includes: diffuse-smoke-test-2
5896

59-
(if visible the action works as expected)
97+
- uses: peter-evans/create-or-update-comment@v1
98+
with:
99+
body: |
100+
### diffuse-smoke-test-2
101+
102+
`steps.diffuse.outputs.diff-gh-comment-no-dex:`
103+
${{ steps.diffuse.outputs.diff-gh-comment-no-dex }}
104+
105+
`steps.diffuse.outputs.summary`
106+
```
107+
${{ steps.diffuse.outputs.summary }}
108+
```
109+
110+
`steps.diffuse.outputs.manifest`
111+
```
112+
${{ steps.diffuse.outputs.manifest }}
113+
```
114+
115+
`steps.diffuse.outputs.dex`
116+
```
117+
${{ steps.diffuse.outputs.dex }}
118+
```
60119
edit-mode: replace
61120
comment-id: ${{ steps.find_comment.outputs.comment-id }}
62121
issue-number: ${{ github.event.pull_request.number }}
63122
token: ${{ secrets.GITHUB_TOKEN }}
64123

65124
- uses: actions/upload-artifact@v2
66125
with:
67-
name: diffuse-output
126+
name: diffuse-output-2
68127
path: ${{ steps.diffuse.outputs.diff-file }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/.idea
22
/.vscode
3+
dupa.py
4+
diffuse-output.txt

action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ outputs:
3131
diff-gh-comment:
3232
description: "Diffuse full output as Github comment"
3333
value: ${{ steps.run-diffuse.outputs.diff-gh-comment }}
34+
diff-gh-comment-no-dex:
35+
description: "Diffuse full output as Github comment, without dex section, workaround forhttps://github.com/JakeWharton/diffuse/issues/96"
36+
value: ${{ steps.run-diffuse.outputs.diff-gh-comment-no-dex }}
3437
summary:
3538
description: "Diffuse summary"
3639
value: ${{ steps.run-diffuse.outputs.summary }}

entrypoint.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,12 @@ def header(_content: str):
3636
\\`\\`\\`
3737
"""
3838

39+
3940
def grouper(iterable, n, fillvalue=None):
4041
args = [iter(iterable)] * n
4142
return zip_longest(*args, fillvalue=fillvalue)
4243

44+
4345
url = "https://github.com/JakeWharton/diffuse/releases/download/{0}/diffuse-{0}-binary.jar" \
4446
.format(os.getenv("INPUT_VERSION"))
4547
downloadArgs = ""
@@ -91,16 +93,23 @@ def grouper(iterable, n, fillvalue=None):
9193
print(f"Found {len(sections)} sections")
9294

9395
github_comment = ""
96+
github_comment_no_dex = ""
97+
github_output_limit = 4500
9498

9599
for (title, content) in grouper(sections, 2):
96100
key = title.lower().strip().replace(" ", "-")
97101
value = content.strip().replace("$", "_")
102+
if len(value) > github_output_limit:
103+
value = value[0:github_output_limit] + "\n...✂"
98104

99-
os.system("echo \"::set-output name={}::{}\"".format(title, github_output(value)))
105+
os.system("echo \"::set-output name={}::{}\"".format(key, github_output(value)))
100106
if key == "summary":
101107
github_comment += header(value)
108+
github_comment_no_dex += header(value)
102109
else:
103-
github_comment += section(key, value)
110+
github_comment += section(title.strip(), value)
111+
if key != "dex":
112+
github_comment_no_dex += section(title.strip(), value)
104113

105114
output = open("diffuse-output.txt", "w")
106115
output.write(diff)
@@ -109,5 +118,6 @@ def grouper(iterable, n, fillvalue=None):
109118
if is_debug():
110119
print(f"Full output stored in: {outputPath}")
111120
os.system(f"echo \"::set-output name=diff-file::{outputPath}\"")
112-
os.system(f"echo \"::set-output name=diff-raw::{github_output(diff)}\"")
121+
os.system(f"echo \"::set-output name=diff-raw::{github_output(diff[0:github_output_limit])}\"")
113122
os.system(f"echo \"::set-output name=diff-gh-comment::{github_output(github_comment)}\"")
123+
os.system(f"echo \"::set-output name=diff-gh-comment-no-dex::{github_output(github_comment_no_dex)}\"")

0 commit comments

Comments
 (0)