Skip to content

Allow for user configurable message header #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ jobs:
only_code: true
# Leave only one comment with the report and update it for consecutive runs
one_comment: true
# The message to be displayed at the start of the report
header_message_start: "The following files have a similarity above the threshold:"
```
## Using duplicate-code-check with pre-commit
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:
Expand Down
7 changes: 7 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ inputs:
description: 'Duplication report will be left as a single comment, which will be updated, instead of multiple ones'
required: false
default: false
header_message_start:
description: 'The message to be displayed at the start of the duplication report.
It is used by the bot to identify previous reports and update them, so it must be unique.
If you want to use the Action in multiple steps of the same workflow,
then you can change this message in each step to avoid conflicts'
required: false
default: '## 📌 Duplicate code detection tool report'
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
2 changes: 1 addition & 1 deletion run_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def main():
files_url_prefix = "https://github.com/%s/blob/%s/" % (repo, args.latest_head)
warn_threshold = os.environ.get("INPUT_WARN_ABOVE")

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