-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
proposal: v2 Improve and simplify config format #449
Comments
Hi, there. Thank you @peaceiris for suggesting this.
|
Hi, there. Thank you for suggesting documentation improvement.
|
I have suggestions for 2 possible ideas on how to restructure the file handling, which both have benefits but also disadvantages. 1) Split types up into separate filesPerhaps it could be worth it to split up issues, PRs and discussions into separate files under a Benefits
Downsides
2) Separate MD file per labelMaybe giving each label a own Markdown file could be the way to go. Files would be (similar to the previous idea) be located in a Example file named ---
allowed: # List of types this action should reply to
- issue
- pull_request
- discussion
# Used to "close", "open", "lock" or "unlock"
action: 'lock'
reason: 'spam' # Used when "lock" is set as action
# Settings to exclude Header/Footer
exclude_header: false
exclude_footer: false
---
## 🔒 LOCKED
This {{ type }} has been **locked** <!-- Maybe a new "{{ type }}" placeholder returning the type? (Issue, Pull request or Discussion) -->
Reason: Spam. A dedicated Benefits
Downsides
If I had to choose would I honestly go with the second option. |
Those are interesting. But we should consider using the YAML anchor/alias at first. labels:
- name: locked (spam)
labeled:
issue:
body: &locked_spam_body |
This issue has been **LOCKED** because of spam!
Please do not spam messages on this project. You may get blocked from this repository for doing so.
action: close
locking: lock
lock_reason: spam
pr:
body: *locked_spam_body
action: close
locking: lock
lock_reason: spam
discussion:
body: *locked_spam_body
locking: lock
lock_reason: spam |
When we check a rendered body with GitHub Flavored Markdown, the
Rendered YAML bodyyq e '.labels[10].labeled.pr.body' .github/label-commenter-config.yml [The documentation label] was added. Thank you for suggesting documentation improvement.
When you add a new section, do not forget to update the Table of Contents.
[The documentation label]: https://github.com/peaceiris/actions-label-commenter/issues?q=label%3Adocumentation
Rendered Markdonw bodyyq e '.labels[10].labeled.pr.body' .github/label-commenter-config.yml | grip - |
Splitting file looks interesting but I won't do that. I am sure that the current single YAML file approach is enough simple in the viewpoint of usability and maintainability. |
Fair enough. Just thought it could be an interesting approach but there are obvious drawbacks and issues with it. |
Maybe we can get another better approach in the future, so I will keep that in mind. Thank you! |
Looking back at this after a relatively long time, I still have a good feeling about using separate markdown files for the different label actions, tho now I think about a slightly different approach. You would still have own markdown files, but the main YAML configuration would now be used to define them. Imagine the following files:
The main configuration, including actions such as opening or closing an issue/PR would remain in the main configuration file, but content to comment would be out-sourced to those markdown files to use. Placeholders such as Maybe, if that is wanted by others could a This would keep the main configuration a lot cleaner because even with that YAML anchor/alias thing is it not the best to look at. All this is up to you of course. |
Discussed in #445
Originally posted by Andre601 June 16, 2021
I feel like the config is kind of bloated in some sections and could receive a improvement.
For example do I see no reason for having a
lock
option when the only goal for it is to havelock
andunlock
as options. This could just be an option for theaction
field and result in close + lock or open + unlock.Another thing that could also be something to improve is the comment option.
This one could be changed to something like this:
The
{{ content }}
placeholder would then be replaced with whatever you defined in the correspondingbody
section of a label.Discussed in #487 (comment)
More generic placeholders for specific values
Right now do I need to use
{{ issue.user.login }}
,{{ pull_request.user.login }}
or{{ discussion.user.login }}
to achieve the same thing for issues, PRs and discussions respectively, which is getting the username of the person that created the issue, PR and/or discussion.This is somewhat annoying to have and I would like to propose some more generic/common placeholders to use, which would use different keys depending on the type.
{{ author }}
- Name of who created the Issue, PR or Discussion.{{ labeler }}
- Name of who labeled the Issue, PR or Discussion.{{ id }}
- The id of the Issue, PR or Discussion. (Maybe? Can't think of a good use-case here)The text was updated successfully, but these errors were encountered: