-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
Add COMMENT_TITLE env var for issue comment title #33
Add COMMENT_TITLE env var for issue comment title #33
Conversation
Thanks for this PR. I was wondering if that comment title should be configurable independently from the check name, maybe through a |
Hi @EnricoMi , thanks for taking a look to the PR.
|
Issue #42 made me think the comment title should use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only minor changes, looks good.
The README.md also needs to mention the new option. Please add it to the example in https://github.com/EnricoMi/publish-unit-test-result-action/blob/master/README.md#using-this-action and put a short description in a new paragraph below check_name
and mention that it defaults to check_name
s value.
publish_unit_test_results.py
Outdated
@@ -693,7 +693,7 @@ def hide_comment(comment_node_id) -> bool: | |||
comments = list([comment for comment in comments | |||
if comment.get('author', {}).get('login') == 'github-actions' | |||
and comment.get('isMinimized') is False | |||
and comment.get('body', '').startswith('## Unit Test Results\n') | |||
and comment.get('body', '').startswith('## {}\n'.format(check_name)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should read issue_comment_title
, rather than check_name
, because this looks at the comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch :)
publish_unit_test_results.py
Outdated
@@ -751,7 +751,7 @@ def main(token: str, event: dict, repo: str, commit: str, files_glob: str, check | |||
stats = get_stats(results) | |||
|
|||
# publish the delta stats | |||
publish(token, event, repo, commit, stats, results['case_results'], check_name, report_individual_runs) | |||
publish(token, event, repo, commit, stats, results['case_results'], issue_comment_title, check_name, report_individual_runs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
publish_unit_test_results.py
Outdated
@@ -735,7 +735,7 @@ def write_stats_file(stats, filename) -> None: | |||
f.write(json.dumps(stats)) | |||
|
|||
|
|||
def main(token: str, event: dict, repo: str, commit: str, files_glob: str, check_name: str, | |||
def main(token: str, event: dict, repo: str, commit: str, files_glob: str, issue_comment_title: str, check_name: str, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we call this comment_title
throughout the file? The title
inside publish_comment
is fine. And can check_name
come first, then comment_title
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, i just thought to name it differently since it shadows the name from the outer scope
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I am going to refactor that code soon, no shadowing then.
All looks good, but one unit test fails, not in your PR #33, but when I pulled your forked branch into my repo for testing, the same commit suddenly fails (#45). I will care about that later. Please fix The You can run the unit tests locally with
|
The action works as expected:
|
Thanks for the contribution! |
This PR allows hard coded issue comment title
Unit Test Results
to be changed whenCOMMENT_TITLE
env var is defined.