Skip to content

ci: dispatch PR lifecycle events to a downstream repo#3926

Open
ericallam wants to merge 1 commit into
mainfrom
ci/pr-events-dispatch
Open

ci: dispatch PR lifecycle events to a downstream repo#3926
ericallam wants to merge 1 commit into
mainfrom
ci/pr-events-dispatch

Conversation

@ericallam

Copy link
Copy Markdown
Member

Summary

Adds a small workflow that sends a repository_dispatch (oss-pr-event) when a pull request changes state (opened, closed, reopened, ready for review, converted to draft, title edited) or when main receives a push. This lets downstream consumers react to PR lifecycle events without polling the API.

Mirrors the existing main-image dispatch in publish.yml (#3875, #3883): same pinned action and token, target repo configurable via repository variables. Same-repo PR events only, since fork contexts carry no secrets; fork merges still reach downstream through the push trigger.

Mirrors the main-image dispatch in publish.yml: on pull request state
changes (opened, closed, reopened, ready for review, converted to
draft, title edits) and pushes to main, send a repository_dispatch so
downstream consumers can react to PR lifecycle events without polling.
Same-repo events only; the target repo is configurable via repository
variables.
@changeset-bot

changeset-bot Bot commented Jun 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: bec078a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

This pull request adds a new GitHub Actions workflow file (.github/workflows/pr-events.yml) that automatically monitors pull request lifecycle changes and pushes to the main branch. When triggered, the workflow constructs an event payload containing either a commit SHA (for pushes) or pull request metadata (for PR events) and dispatches it to a target repository using the peter-evans/repository-dispatch action. The workflow restricts execution to same-repository PRs only (excluding forks) and filters edited events to title-only changes, ensuring controlled event propagation across repositories.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description adequately explains the change and its purpose, but does not follow the required template structure with checklist, testing, changelog, and screenshots sections. Restructure the description to follow the template: include the checklist items, add dedicated Testing and Changelog sections, and include any relevant screenshots or reference the issue being closed.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'ci: dispatch PR lifecycle events to a downstream repo' clearly and concisely describes the main change: adding CI/CD workflow logic to dispatch events downstream when PR lifecycle changes occur.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/pr-events-dispatch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/pr-events.yml (1)

21-25: 💤 Low value

Consider renaming PR_EVENTS_DISPATCH_REPO for clarity.

The variable name PR_EVENTS_DISPATCH_REPO suggests it might be the dispatch target, but it's actually validating the source repository where the workflow should run. This contrasts with PR_EVENTS_DISPATCH_TARGET (line 48) which is the actual destination. A maintainer could mistakenly configure this variable thinking it controls where events are sent.

Consider renaming to something like PR_EVENTS_SOURCE_REPO or adding a comment clarifying its purpose.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: cde4a033-2e55-494d-a8ce-fab0464ca9eb

📥 Commits

Reviewing files that changed from the base of the PR and between 4783419 and bec078a.

📒 Files selected for processing (1)
  • .github/workflows/pr-events.yml
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (actions)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
.github/workflows/pr-events.yml (4)

1-7: LGTM!


8-12: LGTM!


27-42: LGTM!


44-50: LGTM!

@ericallam ericallam marked this pull request as ready for review June 12, 2026 14:53

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

Open in Devin Review

Comment thread .github/workflows/pr-events.yml
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.

1 participant