Skip to content

Commit 0a89396

Browse files
Merge pull request #43 from usefulness/use_fork
2 parents 19f8c68 + 1068752 commit 0a89396

File tree

3 files changed

+26
-11
lines changed

3 files changed

+26
-11
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ The work
2222
##### Parameters
2323
`old-file-path` - Path to reference file the diff should be generated for
2424
`new-file-path` - Path to current file the diff should be generated for
25-
`lib-version` _(Optional)_ - Overrides [Diffuse](https://github.com/JakeWharton/diffuse) dependency version
25+
`lib-version` _(Optional)_ - Overrides [Diffuse](https://github.com/JakeWharton/diffuse) dependency version
26+
`fork-version` _(Optional)_ - Uses [Diffuse](https://github.com/usefulness/diffuse) fork with a fiven version
2627

2728
### Sample: Create Pull Request comment
2829

action.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@ inputs:
1414
description: 'new mapping file produced by R8 or ProGuard'
1515
required: false
1616
lib-version:
17-
description: 'diffuse tool version'
18-
required: true
19-
default: '0.1.0'
17+
description: 'JakeWharton/diffuse tool version'
18+
required: false
19+
fork-version:
20+
description: 'usefulness/diffuse fork version'
21+
required: false
22+
default: '0.2.0'
2023
debug:
2124
description: 'if true, shows additional debug information'
2225
required: false
23-
default: false
26+
default: 'false'
2427
outputs:
2528
diff-raw:
2629
description: "Diffuse full output"
@@ -91,6 +94,7 @@ runs:
9194
INPUT_OLD_MAPPING_FILE: ${{ inputs.old-mapping-path }}
9295
INPUT_NEW_MAPPING_FILE: ${{ inputs.new-mapping-path }}
9396
INPUT_VERSION: ${{ inputs.lib-version }}
97+
INPUT_FORK_VERSION: ${{ inputs.fork-version }}
9498
INPUT_DEBUG: ${{ inputs.debug }}
9599
run: python3 ${{ github.action_path }}/entrypoint.py
96100
shell: bash

entrypoint.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,28 @@
55
from itertools import zip_longest
66

77

8+
def find_tool_url():
9+
lib_version = os.getenv("INPUT_VERSION", "").strip()
10+
if lib_version:
11+
return "https://github.com/JakeWharton/diffuse/releases/download/{0}/diffuse-{0}-binary.jar" \
12+
.format(lib_version)
13+
else:
14+
return "https://github.com/usefulness/diffuse/releases/download/{0}/diffuse-{0}-binary.jar" \
15+
.format(os.getenv("INPUT_FORK_VERSION"))
16+
17+
818
def is_debug():
919
return os.getenv("INPUT_DEBUG", False)
1020

1121

12-
def github_output(message: str):
22+
def github_output(message):
1323
return message.replace("%", "%25") \
1424
.replace("\n", "%0A") \
1525
.replace("\r", "%0D") \
1626
.replace('\x00', '')
1727

1828

19-
def section(_title: str, _content: str):
29+
def section(_title, _content):
2030
return f"""
2131
<details>
2232
<summary>{_title}</summary>
@@ -29,7 +39,7 @@ def section(_title: str, _content: str):
2939
"""
3040

3141

32-
def header(_content: str):
42+
def header(_content):
3343
return f"""
3444
\\`\\`\\`
3545
{_content}
@@ -56,8 +66,7 @@ def sizeof_fmt(num, suffix='B', sign=False):
5666
return "%.1f%s%s" % (num, 'Yi', suffix)
5767

5868

59-
url = "https://github.com/JakeWharton/diffuse/releases/download/{0}/diffuse-{0}-binary.jar" \
60-
.format(os.getenv("INPUT_VERSION"))
69+
url = find_tool_url()
6170
downloadArgs = ""
6271
if not is_debug():
6372
downloadArgs += "-q"
@@ -156,4 +165,5 @@ def sizeof_fmt(num, suffix='B', sign=False):
156165
os.system(f"echo \"::set-output name=diff-gh-comment::{github_output(github_comment)}\"")
157166
os.system(f"echo \"::set-output name=diff-gh-comment-all-collapsed::{github_output(github_comment_all_collapsed)}\"")
158167
os.system(f"echo \"::set-output name=diff-gh-comment-no-dex::{github_output(github_comment_no_dex)}\"")
159-
os.system(f"echo \"::set-output name=diff-gh-comment-no-dex-all-collapsed::{github_output(github_comment_no_dex_all_collapsed)}\"")
168+
os.system(
169+
f"echo \"::set-output name=diff-gh-comment-no-dex-all-collapsed::{github_output(github_comment_no_dex_all_collapsed)}\"")

0 commit comments

Comments
 (0)