Skip to content

chore: add pr-comments workflow with default messages #44

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

Merged
merged 2 commits into from
Mar 25, 2025

Conversation

MantisClone
Copy link
Member

@MantisClone MantisClone commented Mar 24, 2025

Description

This Pull Request adds the pr-comments.yml workflow which posts customizable comments on Pull Requests submitted by external contributors (those outside the RequestNetwork organization).

The workflow leaves comments in these situations:

  • On a contributor's first Pull Request to your repository
  • When a Pull Request is marked as ready for review
  • When a Pull Request is merged

Details

It uses the GH_PAT_AUTO_COMMENTS organization secret which is a Personal Access Token provided by @MantisClone (me). Thus, the comments look like they're being posted by me.

Default messages

First PR Comment:

'Hello @{{username}}, thank you for submitting your first pull request to the {{repository}} repository. We value your contribution and encourage you to review our contribution guidelines to ensure your submission meets our standards. Please note that every merged PR is automatically enrolled in our Best PR Initiative, offering a chance to win $500 each quarter. Our team is available via GitHub Discussions or Discord if you have any questions. Welcome aboard!'

Ready for Review Comment:

'Thank you for your submission! As you prepare for the review process, please ensure that your PR title, description, and any linked issues fully comply with our contribution guidelines. A clear explanation of your changes and their context will help expedite the review process. Every merged PR is automatically entered into our Best PR Initiative, offering a chance to win $500 every quarter. We appreciate your attention to detail and look forward to reviewing your contribution!'

Merged Comment:

'Congratulations, your pull request has been merged! Thank you for your valuable contribution to Request Network. As a reminder, every merged PR is automatically entered into our Best PR Initiative, offering a quarterly prize of $500. Your work significantly supports our project''s growth, and we encourage you to continue engaging with our community. Additionally, if you want to build or add crypto payments and invoicing features, explore how our API can reduce deployment time from months to hours while offering advanced features. Book a call with our expert to learn more and fast-track your development.'

Test

This test pull request created by an external user shows 3 messages being sent at the appropriate times.

Context

Towards:

Considerations

  • Why not use an off-the-shelf action from the Github Actions Marketplace?
  • The pr-comments.yml workflow is installed using the @main tag so this repo will pull the latest default messages from the auto-comments repo as soon as they're merged to the main branch.

Reference

Summary by CodeRabbit

  • New Features
    • Introduced an automation tool that posts standardized comments on pull requests when they are opened, marked ready for review, or closed. This enhancement streamlines communication and ensures consistent feedback during reviews.

Copy link
Contributor

coderabbitai bot commented Mar 24, 2025

Walkthrough

A new GitHub Actions workflow file (pr-comments.yml) has been added. This workflow is triggered on pull request creation, transitioning to ready for review, or closure. It defines a job named pr-comments that calls an external workflow (pr-auto-comments.yml) from the RequestNetwork/auto-comments repository. The workflow uses the organization name "RequestNetwork" and a secret token from repository secrets (GH_PAT_AUTO_COMMENTS) for authentication to automate the posting of comments on pull requests.

Changes

File(s) Summary
.github/workflows/pr-comments.yml Added a new workflow file triggered on pull request events. It defines a job to invoke an external workflow for auto-posting PR comments using a secret token.

Sequence Diagram(s)

sequenceDiagram
    participant PR as Pull Request Event
    participant GH as GitHub Actions
    participant WC as pr-comments Workflow
    participant EW as External Workflow (pr-auto-comments)

    PR->>GH: Trigger event (open, ready, or close)
    GH->>WC: Start pr-comments job
    WC->>EW: Invoke external workflow with GH_PAT_AUTO_COMMENTS and org "RequestNetwork"
    EW-->>WC: Execute auto-comment posting
    WC-->>GH: Job completion
Loading

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

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

7-15: Job Definition Using an External Workflow
The job correctly references an external workflow (pr-auto-comments.yml) from the "RequestNetwork/auto-comments" repository. The use of the with block to pass org_name and the proper injection of the secret token via ${{ secrets.GH_PAT_AUTO_COMMENTS }} is well implemented. One suggestion is to consider pinning the external workflow to a specific commit hash instead of using the @main ref to prevent unexpected changes from upstream in the future.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c82b6b3 and b1e6d31.

📒 Files selected for processing (1)
  • .github/workflows/pr-comments.yml (1 hunks)
🔇 Additional comments (2)
.github/workflows/pr-comments.yml (2)

1-2: Workflow Naming Clarity
The workflow name "PR Comments" clearly reflects the intent to post comments on pull requests. Consider adding a brief description via comments if further context is desired later.


3-6: Appropriate Trigger Configuration
The workflow is triggered on pull request events (opened, ready for review, closed) using the pull_request_target event. This is suitable for workflows that require access to repository secrets. Just be sure that the elevated privileges inherent with pull_request_target are acceptable given your security posture.

@MantisClone MantisClone linked an issue Mar 24, 2025 that may be closed by this pull request
@MantisClone MantisClone enabled auto-merge (squash) March 24, 2025 21:01
@MantisClone MantisClone merged commit 69a068c into main Mar 25, 2025
5 checks passed
@MantisClone MantisClone deleted the add-auto-comments branch March 25, 2025 07:36
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.

Deploy the "Best PR" Initiative
2 participants