Skip to content

Output the contributors as JSON - #304

Open
obenland wants to merge 2 commits into
WordPress:trunkfrom
obenland:add/contributors-output
Open

obenland wants to merge 2 commits into
WordPress:trunkfrom
obenland:add/contributors-output

Conversation

@obenland

@obenland obenland commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

See #242.

This is the structured-output half of #242. Workflows that build their own credits, such as release notes or a readme's contributor list, had to parse the rendered comment to get at the accounts. The new contributors output gives them the list as JSON:

[
  { "github": "octocat", "email": null, "wporg": "octo" },
  { "github": null, "email": "co-author@git.wordpress.org", "wporg": "co-author" },
  { "github": null, "email": "someone@example.com", "wporg": null },
  { "github": "newcomer", "email": null, "wporg": null }
]
  • Entries come in the order the comment credits them, after @propsbot add and remove commands are applied.
  • email is set for contributors without a GitHub account: the address from a commit GitHub can't match to an account, or the <username>@git.wordpress.org address generated for a WordPress.org user added with @propsbot add (Accept WordPress.org usernames in @propsbot add #315). wporg is null for anyone without a linked WordPress.org account, matching the comment's unlinked list.
  • The output is set before the comment is posted, so it's there even when posting fails. It's an empty array when there are no contributors.

Each contributor is listed once, under the first way they contributed, which is how the collector already dedupes them. That's why there are no per-contributor roles, which #242 suggested: adding them would mean changing the collector to keep every role.

The release-aggregation mode from #242 isn't part of this PR.

Testing

  1. In a workflow, read it with fromJSON( steps.<id>.outputs.contributors ).
  2. Check the list against the props comment.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings October 23, 2026 20:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@lancewillett

Copy link
Copy Markdown
Member

Could you clarify what email means for a contributor added with @propsbot add? I ran the existing “credits added usernames” test on the merge with trunk. Its fixture has zero commits. After @propsbot add Added, the output contains {"github":null,"email":"added@git.wordpress.org","wporg":"added"}.

That address is generated from the WordPress.org username by #315. A release workflow following the README could mistake it for an address supplied by a commit author. The smallest fix looks like documenting both sources in the README and action metadata, then asserting this entry in the existing test. All 42 tests passed on the combined code.

@lancewillett lancewillett moved this from In review to In progress in WordPress Project Build Tooling Nov 29, 2026
obenland and others added 2 commits November 30, 2026 11:36
Workflows that build their own credits, like release notes or a readme's
contributor list, had to parse the rendered comment to get at the accounts.
The new `contributors` output lists each contributor's GitHub username,
commit email when there is no GitHub account, and WordPress.org username.

See WordPress#242.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Since WordPress#315, a WordPress.org user added with `@propsbot add` is credited
under a `<username>@git.wordpress.org` address generated from the
username, and the output carries it as `email`. The docs said `email`
came only from commit authors, so a workflow could take the generated
address for one a commit author supplied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@obenland
obenland force-pushed the add/contributors-output branch from 01a648e to 2b0978e Compare November 30, 2026 17:37
@obenland

Copy link
Copy Markdown
Member Author

@lancewillett Thanks, fixed in 2b0978e: the README and action.yml now name both sources, and the existing test asserts that entry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

3 participants