ci: replace disabled topic-commenter with explore-triage-commenter#5151
Merged
ci: replace disabled topic-commenter with explore-triage-commenter#5151
Conversation
Posts a sticky maintainer-facing comment on PRs that touch topic or collection pages. For topic PRs: repo count for the topic. For collection PRs: per-item stars, last push, owner type, and a self-submission flag. Edit-in-place via marker comment, so synchronize/reopen events update the same comment instead of stacking. Reads PR head content via repos.getContent at pr.head.sha rather than checking out the fork (avoids the issues addressed in #5094 by sidestepping checkout entirely).
Replaced by .github/workflows/explore-triage-commenter.yml in the preceding commit. The original commenter has been disabled (paths gated to ENOSUCHPATH) since it failed on fork PRs due to permissions on the pull_request trigger; the replacement uses pull_request_target and reads PR head content via the API instead of checking out, which sidesteps the issue entirely.
Contributor
There was a problem hiding this comment.
Pull request overview
Replaces the previously-disabled topic-commenter.yml workflow with a new explore-triage-commenter.yml workflow that posts (and updates in place) a maintainer-facing triage comment on PRs that modify topics/** or collections/**, using pull_request_target and GitHub API reads instead of checking out fork content.
Changes:
- Delete the disabled
topic-commenter.ymlworkflow. - Add
explore-triage-commenter.ymlto generate a sticky triage comment summarizing touched topics (repo counts) and collections (repo metadata table).
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/topic-commenter.yml | Removes the legacy workflow that was path-gated and effectively disabled. |
| .github/workflows/explore-triage-commenter.yml | Adds a pull_request_target workflow to post/update a sticky maintainer triage comment for topic/collection PRs. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 3
Agent-Logs-Url: https://github.com/github/explore/sessions/1439af4e-c097-4fc9-8a1f-22c96f6de461 Co-authored-by: kenyonj <4008677+kenyonj@users.noreply.github.com>
Agent-Logs-Url: https://github.com/github/explore/sessions/f0f46334-8894-40b6-bcc2-87dba102c83d Co-authored-by: kenyonj <4008677+kenyonj@users.noreply.github.com>
Contributor
|
Nice, this looks great! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace the disabled
topic-commenter.ymlworkflow with a newexplore-triage-commenter.ymlthat posts a sticky maintainer-facing comment on PRs touching topic or collection pages.The original
topic-commenter.ymlhas been disabled (paths gated toENOSUCHPATH) since [d52a3fd] because it failed on fork PRs —pull_requestdoesn't grant write tokens to forked-PR runs, so the comment step always failed with a permission error. This PR sidesteps the issue entirely by usingpull_request_targetand reading PR head content via the API instead of checking out the fork.What it does
For PRs that touch
topics/**orcollections/**, the workflow posts a single comment containing:GET /search/repositories?q=topic:<slug>and a link to the live topic page.items:entries with star count, last push date, owner type, and a⚠️ possible self-submissionflag when the PR author's login matches an item's owner segment.The comment is updated in place on subsequent runs (
synchronize,reopened) via a<!-- explore-triage-comment -->marker, so the table stays current as a PR evolves rather than stacking new comments.Example output
A PR adding
ollamaas a topic plus appending two items tocollections/ai-agents/:Design choices
pull_request_target+ read-only API access. Noactions/checkoutstep. PR commits from forks are mirrored into the base repo's network, sorepos.getContent({ref: pr.head.sha})works against the base repo. This keeps the workflow simple and avoids the fork-checkout class of issues addressed in Fix lint workflow failing on fork PRs #5094.contents: read,pull-requests: write. No write access to repository contents.^[a-z0-9](?:[a-z0-9-]{0,80}[a-z0-9])?$for slugs,^[\w.-]+/[\w.-]+$for items) before being passed to any API call. Content read from PR head is treated as data, never executed or interpolated into shell or paths.npm install js-yamlstep. The format is highly consistent across all 101 collections; a regex-based extractor of theitems:block is sufficient and self-contained.Testing
Tested in
kenyonj/explorewith the workflow onmainandpull_request_targetenabled:0 repositories✓ollama, ~12k repos)11,932 repositories✓⚠️ possible self-submissioncorrectly flagged onkenyonj/zoney. After asynchronizepush, comment updated in place (same comment id, no duplicate) ✓Intentionally not in v1
status === 'renamed'/previous_filename).Drops
.github/workflows/topic-commenter.yml— disabled since [d52a3fd], superseded by this workflow.