Skip to content
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

Pretty print labels #31

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JakeCooper
Copy link

@JakeCooper JakeCooper commented Nov 2, 2021

Awesome action. Thoughts on a lil bit o pretty printing of the labels?

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request does not contain a valid label. Please add one of the following labels: ['bug', 'enhancement']

@@ -238,9 +238,10 @@ def get_env_var(env_var_name, echo_value=False):
if review_missing_label:
print('The last review already requested changes')
else:
formatted_labels = "\n".join(map(lambda label: f"• {label}", valid_labels))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the suggestion @JakeCooper. Although I don't think the code as-is will have the intended result. The message looks like this:
message_1

Instead, I think you want the code to be:

formatted_labels = "\n".join(f"* `{label}`" for label in valid_labels)
pr.create_review(
    body='This pull request does not contain a valid label.\n\nPlease '
         f'add one of the following labels:\n{formatted_labels}',
    event='REQUEST_CHANGES')

(also, the map and lambda are not really needed, the simplified code above will produce the same result).

With this change the message looks like this (which I think if what you wanted?):
message_2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants