Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions .github/workflows/request-rfc-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Request RFC review

on:
pull_request_target:
types: [opened, ready_for_review]
paths:
- "rfcs/**"

permissions:
pull-requests: write
contents: read

jobs:
request-review:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- name: Detect new RFC and request reviews
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const prNumber = context.payload.pull_request.number;
const author = context.payload.pull_request.user.login.toLowerCase();

const maintainers = [
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Just a thought, have you considered creating a team in MLflow org that this workflow could tag or adding OWNERS file to the repo instead?

"dbczumar",
"daniellok-db",
"harupy",
"kriscon-db",
"mprahl",
"PattaraS",
"serena-ruan",
"TomeHirata",
"B-Step62",
];

// List files in the PR (paginate to be safe).
const files = await github.paginate(github.rest.pulls.listFiles, {
owner,
repo,
pull_number: prNumber,
per_page: 100,
});

// A new RFC adds a markdown file under a new rfcs/<slug>/ directory,
// e.g. rfcs/0004-skill-registry/0004-skill-registry.md.
const rfcRegex = /^rfcs\/[^/]+\/[^/]+\.md$/;
const newRfcFiles = files.filter(
(f) => f.status === "added" && rfcRegex.test(f.filename)
);
if (newRfcFiles.length === 0) {
core.info("No new RFC markdown file added; skipping review request.");
return;
}

// Avoid posting twice if the workflow re-runs (e.g. opened -> ready_for_review).
const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number: prNumber,
per_page: 100,
});
const marker = "<!-- rfc-review-request -->";
if (comments.some((c) => c.body && c.body.includes(marker))) {
core.info("RFC review-request comment already posted; skipping.");
return;
}

const reviewers = maintainers.filter(
(m) => m.toLowerCase() !== author
);
const mentionList = reviewers.map((m) => `@${m}`).join(" ");

const body = [
marker,
`Thanks for opening a new RFC! ${mentionList} — please take a look when you have a chance and leave your feedback.`,
"",
"Reviewers: see the [RFC process](../blob/main/README.md) for guidance on what to look for.",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I don't think we can use relative links in the comments

Suggested change
"Reviewers: see the [RFC process](../blob/main/README.md) for guidance on what to look for.",
"Reviewers: see the [RFC process](https://github.com/mlflow/rfcs/blob/main/README.md) for guidance on what to look for.",

].join("\n");

await github.rest.issues.createComment({
owner,
repo,
issue_number: prNumber,
body,
});
core.info(`Requested review from ${reviewers.length} maintainer(s).`);