Skip to content

chore: add bot to comment on PRs #28953

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

bartlomieju
Copy link
Member

No description provided.

@bartlomieju bartlomieju requested a review from Copilot April 18, 2025 09:52
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces a bot that automates commenting and labeling pull requests by adding a new JavaScript script and configuring a corresponding GitHub Actions workflow.

  • Added a script (tools/label_pull_request.js) to create a comment and update labels when a pull request is opened, reopened, or review requested.
  • Added a GitHub Actions workflow (.github/workflows/pull_request_labels.yaml) to trigger the script on defined pull request events.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tools/label_pull_request.js Adds bot functionality to comment on and label pull requests.
.github/workflows/pull_request_labels.yaml Configures the GitHub Action to run the bot for specific PR events.

bartlomieju and others added 4 commits April 18, 2025 12:05
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Bartek Iwańczuk <biwanczuk@gmail.com>
});
}

// TODO(bartlomieju): figure out how to use ES modules in GH Actions scripts
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems to work well like below.

tools/package.json
{
  "type": "module"
}

https://github.com/actions/github-script/blob/e7aeb8c663f696059ebb5f9ab1425ed2ef511bdb/README.md#use-esm-import

Copy link
Member Author

Choose a reason for hiding this comment

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

Cool thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

Note to self and @dsherret - make sure that CI actually runs on draft PRs, change the "ci-draft" label to "draft-no-ci" (flip to logic so that label disables CI(

repo: context.repo.repo,
});
const labelNames = result.data.map((label) => label.name);
labelNames.push("pr:needs-review");
Copy link
Member Author

Choose a reason for hiding this comment

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

Create this label before landing

Copy link
Member Author

Choose a reason for hiding this comment

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

Change this to actually add a label, once a review is requested

repo: context.repo.repo,
body: `Thanks for the PR!

Once you are done, please request a review from a Deno team member.`,
Copy link
Member Author

Choose a reason for hiding this comment

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

"If this PR is not ready for a review, please mark it as a draft"

Copy link
Member Author

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

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

Add "pr:waiting-for-author" label, if any person from denoland org submits a review with a comment, this label should be added automatically (and removed once a review is requested again).

@dsherret dsherret changed the title chore: Add bot to comment on PRs chore: add bot to comment on PRs May 15, 2025
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.

2 participants