Skip to content

Commit

Permalink
Rename comment header to message header for correctness
Browse files Browse the repository at this point in the history
  • Loading branch information
platisd committed May 1, 2022
1 parent 8a487db commit 99622dd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,5 @@ Important fields:
with the syntax described earlier.
* `github_token`: You must provide the GitHub token for the Action to be able to view and
most importantly edit your pull request description.
* (Optional) `comment_header`: You may provide a custom message to be displayed above the checklist instead of the
* (Optional) `message_header`: You may provide a custom message to be displayed above the checklist instead of the
default one found in [action.yml]().
6 changes: 3 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ inputs:
dod_yaml:
description: 'The relative path to the YAML file with your DoD'
required: true
comment_header:
description: 'The header of the comment with the DoD checklist'
default: '### :ballot_box_with_check: Definition of Done checker'
message_header:
description: 'The header of the message with the DoD checklist'
default: '### :ballot_box_with_check: Definition of Done checklist'
runs:
using: 'docker'
image: 'Dockerfile'
Expand Down
8 changes: 4 additions & 4 deletions run_action.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
import argparse
import yaml

COMMENT_HEADER = os.environ["INPUT_COMMENT_HEADER"]
MESSAGE_HEADER = os.environ["INPUT_MESSAGE_HEADER"]
EMPTY_CHECKMARK = "- [ ]"


def dod_criteria_to_message(dod_criteria):
message = COMMENT_HEADER + "\n"
message = MESSAGE_HEADER + "\n"
for criterion in dod_criteria:
message += EMPTY_CHECKMARK + " " + criterion + "\n"
return message


def has_bot_comment(pull_request_description):
return COMMENT_HEADER in pull_request_description
return MESSAGE_HEADER in pull_request_description


def has_unsatisfied_dod(pull_request_description, dod_criteria):
# Extract the bot message from the pull request description
bot_message_begin = pull_request_description.find(COMMENT_HEADER)
bot_message_begin = pull_request_description.find(MESSAGE_HEADER)
last_criterion = dod_criteria[-1]
bot_message_end = pull_request_description.find(last_criterion)
if bot_message_end == -1:
Expand Down

0 comments on commit 99622dd

Please sign in to comment.