Skip to content

Commit f0413b1

Browse files
committed
Allow for user configurable message header
Allow users to specify if they want the report's header. This will allow them to customize the behavior and enable multiple Action runs in different steps of the same workflow as long as each title is unique. Fixes #32
1 parent 4161a9b commit f0413b1

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ jobs:
158158
only_code: true
159159
# Leave only one comment with the report and update it for consecutive runs
160160
one_comment: true
161+
# The message to be displayed at the start of the report
162+
header_message_start: "The following files have a similarity above the threshold:"
161163
```
162164
## Using duplicate-code-check with pre-commit
163165
To use Duplicate Code Detection Tool as a pre-commit hook with [pre-commit](https://pre-commit.com/) add the following to your `.pre-commit-config.yaml` file:

action.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ inputs:
3939
description: 'Duplication report will be left as a single comment, which will be updated, instead of multiple ones'
4040
required: false
4141
default: false
42+
header_message_start:
43+
description: 'The message to be displayed at the start of the duplication report.
44+
It is used by the bot to identify previous reports and update them, so it must be unique.
45+
If you want to use the Action in multiple steps of the same workflow,
46+
then you can change this message in each step to avoid conflicts'
47+
required: false
48+
default: '## 📌 Duplicate code detection tool report'
4249
runs:
4350
using: 'docker'
4451
image: 'Dockerfile'

run_action.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def main():
164164
files_url_prefix = "https://github.com/%s/blob/%s/" % (repo, args.latest_head)
165165
warn_threshold = os.environ.get("INPUT_WARN_ABOVE")
166166

167-
header_message_start = "## 📌 Duplicate code detection tool report\n"
167+
header_message_start = os.environ.get("INPUT_HEADER_MESSAGE_START") + "\n"
168168
message = header_message_start
169169
message += "The [tool](https://github.com/platisd/duplicate-code-detection-tool)"
170170
message += " analyzed your source code and found the following degree of"

0 commit comments

Comments
 (0)