-
Notifications
You must be signed in to change notification settings - Fork 7
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
Reformat the Props Bot comment #21
Changes from all commits
dbd7ca5
9bfdbf4
3c9cb48
6df5feb
5f7e6b7
bd1c7ce
a2b9c88
8c631f2
ee2caed
a74a6c2
b212ae0
03d60a3
93260ce
5ca2d5e
dae2833
b5e878f
9d62018
124373b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,14 +113,17 @@ export default class GitHub { | |
* - If a comment already exists, it will be updated. | ||
* | ||
* @param {Object} context The GitHub context. | ||
* @param {string} contributorsList The list of contributors. | ||
* @param {array} contributorsList The list of contributors. | ||
*/ | ||
async commentProps({ context, contributorsList }) { | ||
if (!contributorsList) { | ||
core.info("No contributors list provided."); | ||
core.info("No contributors were provided."); | ||
return; | ||
} | ||
|
||
core.debug( "Contributor list received:" ); | ||
core.debug( contributorsList ); | ||
|
||
let prNumber = context.payload?.pull_request?.number; | ||
if ( 'issue_comment' === context.eventName ) { | ||
prNumber = context.payload?.issue?.number; | ||
|
@@ -133,23 +136,42 @@ export default class GitHub { | |
issue_number: prNumber, | ||
}; | ||
|
||
const commentMessage = | ||
"Here is a list of everyone that appears to have contributed to this PR and any linked issues:\n\n" + | ||
let commentMessage = "The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the `props-bot` label.\n\n"; | ||
|
||
if ( contributorsList['unlinked'].length > 0 ) { | ||
commentMessage += "## Unlinked Accounts\n\n" + | ||
"The following contributors have not linked their GitHub and WordPress.org accounts: @" + contributorsList['unlinked'].join(', @') + ".\n\n" + | ||
"Contributors, please [read how to link your accounts](https://make.wordpress.org/core/2020/03/19/associating-github-accounts-with-wordpress-org-profiles/) to ensure your work is properly credited in WordPress releases.\n\n"; | ||
} | ||
|
||
commentMessage += "## Core SVN\n\n" + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @desrosj, would it be possible to make this configurable? While
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you make an issue for this on the @WordPress/props-bot-core repo? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pleasure: #38 :) |
||
"If you're a Core Committer, use this list when committing to `wordpress-develop` in SVN:\n" + | ||
"```\n" + | ||
contributorsList + | ||
"\n```"; | ||
"Props: " + contributorsList['svn'].join(', ') + "." + | ||
"\n```\n\n" + | ||
"## GitHub Merge commits\n\n" + | ||
"If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.\n\n" + | ||
"```\n"; | ||
|
||
if ( contributorsList['unlinked'].length > 0 ) { | ||
commentMessage += "Unlinked contributors: " + contributorsList['unlinked'].join(', ') + ".\n\n"; | ||
} | ||
|
||
commentMessage += contributorsList['coAuthored'].join("\n") + | ||
"\n```\n\n" + | ||
"**To understand the WordPress project's expectations around crediting contributors, please [review the core handbook](https://make.wordpress.org/core/handbook/).**\n"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added ticket #29 to replace this link, but it's not a blocker. |
||
|
||
const comment = { | ||
...commentInfo, | ||
body: commentMessage + "\n\n<sub>props-bot-action</sub>", | ||
body: commentMessage, | ||
}; | ||
|
||
const comments = (await this.octokit.rest.issues.listComments(commentInfo)) | ||
.data; | ||
for (const currentComment of comments) { | ||
if ( | ||
currentComment.user.type === "Bot" && | ||
/<sub>[\s\n]*props-bot-action/.test(currentComment.body) | ||
currentComment.body.includes( 'The following accounts have interacted with this PR and/or linked issues.' ) | ||
) { | ||
commentId = currentComment.id; | ||
break; | ||
|
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.
Is it possible to obtain the GitHub no-reply email addresses via the WP API you're using, ie in the format
[email protected]
? This will allow co-authored commits to show up without people needing to associate it with their account. As an example, mine is[email protected]
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.
We can, but because our ultimate goal is to give credit in the Credits API, I chose to use the
[email protected]
format. I also didn't love the idea of hard coding personal emails in the commit messages if someone has that setting turned off. I don't recall if the anonymous format worked even if you had that disabled. I could test if there's a strong preference to use that format instead.The other thought I had was for consistency with how committers are attributed credit from the WordPress/wordpress-develop mirror. When a contributor is granted commit access, they are told to add the
@git.wordpress.org
format to their account, as that's the email given to the commit author. A "pie in the sky" idea that I'll investigate once we get this initial round settled is to includeCo-Authored-By
trailers for everyone that receives Props in an SVN commit. My thinking there is that the same format as the committer would make sense.By including unlinked contributors in the commit message, though, we can easily extract their GH slug from the list and look in the .org database for any contributors that have connected their account since any of their contributions were merged.
There's some weirdness to detail around those emails as noted on that page:
Another layer to that is on the Change your username page:
So we'd always need to use the
ID+USERNAME
format just in case someone changes their username. On the other hand, WP.org usernames cannot be changed.Sorry for the brain dump, but this was a good chance to document some of my thinking/findings.
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.
Given the goal here is to improve the breadth of folks properly credited from GitHub repos back to WordPress core major releases and to streamline the major release credits gathering process, the approach that @desrosj has here makes sense. If the goal was to ensure all GitHub users were properly credited on PRs, then using the format @peterwilsoncc noted would likely be the best approach.
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.
Been thinking about this the last few days.
I think I do prefer using all .org usernames, but it could be reasonable to use the GH format email for any contributor that's not linked to a .org one.
We can still parse out their GH user and look them up in the .org API, and they'd receive attribution on GH from their anonymous email. But that also removes some of the incentive to connect their account in the first place.
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.
@desrosj Does the WP.org integration add
[email protected]
to a users profile when they link their accounts or is that a step the contributor would need to do to get recognition on GitHub?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.
Currently, they will need to add it manually. I plan to include this in the announcement post, and the documentation. Based on this comment , though, it doesn't seem that our authentication request currently allows us to modify your profile at all. We'd need to add that to the request, and contributors with pre-existing connections would need to re-approve the connection with the new permissions.
I was talking this through with @dd32 last night. Wanted to document our discussion. At first he did not like using
@git.wp.org
emails, but after some discussion, this was how he summarized his thoughts:It's worth noting that in that list, there are currently no SVN -> Git syncs that do not make it over to GitHub.
Some other takeaways from our discussion:
ID+username@github
emails would be out of place. We could likely add a way for the tool to support these, but using wp.org ones would be somewhat tool-agnostic.@git.wp.org
email that represents you. Adding the ability to verify this through email will likely be appropriate to avoid any problems.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.
I've gone and created #28 for changing the unlinked contributor list to use GH emails. I think that makes sense, but figured it would be good to tackle separately.