Skip to content

ci: Introduce HPX PR Sentinel (Automated Rule-Based Review & Labeling Bot)#7207

Open
arpittkhandelwal wants to merge 1 commit intoTheHPXProject:masterfrom
arpittkhandelwal:feature/hpx-pr-sentinel
Open

ci: Introduce HPX PR Sentinel (Automated Rule-Based Review & Labeling Bot)#7207
arpittkhandelwal wants to merge 1 commit intoTheHPXProject:masterfrom
arpittkhandelwal:feature/hpx-pr-sentinel

Conversation

@arpittkhandelwal
Copy link
Copy Markdown
Contributor

Description

This Pull Request introduces the HPX PR Sentinel, an automated rule-based GitHub Action designed to improve contributor experience and streamline the code review process for maintainers.

The bot is entirely native to GitHub Actions (no external LLM or API dependencies) and uses actions/github-script alongside actions/labeler.

🚀 Sentinel Features

The HPX PR Sentinel automatically runs on the pull_request_target event and performs the following checks:

1. Automated File Labeling

  • Uses actions/labeler@v5 to apply standard labels (like cmake, documentation, core, full, tests, github-actions, etc.) purely based on the file paths modified in the PR.

2. Maintainer Acknowledgment

  • Trigger: Whenever a PR is opened.
  • Message: Greets the contributor, confirms the PR is logged, and asks them to wait for a maintainer to review.

3. First-Time Contributor Welcome

  • Trigger: If the PR author's association is FIRST_TIME_CONTRIBUTOR or NONE.
  • Message: Gives a warm, enthusiastic welcome to the HPX project!

4. Title Formatting Check

  • Trigger: If the PR title does not follow Conventional Commits format (e.g. feat:, fix:, docs:).
  • Message: Prompts authors to abide by standard git history formatting (soft warning, not a block).

5. Work In Progress (WIP) Warning

  • Trigger: If the PR is a draft or has "WIP" in its title.
  • Message: Reminds the author to mark the PR as ready for review once they finish building it.

6. Description Length Check

  • Trigger: If the PR description is entirely missing or less than 20 characters long.
  • Message: Gently scolds the author and asks for a more detailed summary of their changes.

7. Massive PR Alert (Titan Check)

  • Trigger: If the PR modifies more than 750 lines total (additions + deletions).
  • Message: Warns the author that this is huge and suggests breaking it up for human reviewers.

8. Missing Tests Reminder

  • Trigger: If the PR modifies *.cpp or *.hpp files but does not touch any files inside the /tests folder.
  • Message: Reminds the developer to "be a hero" and include testing for their changes.

9. Changelog Enforcer

  • Trigger: If source files are modified but no CHANGELOG or RELEASE_NOTES are updated.
  • Message: Reminds the author to leave a trace of their work in the project history.

10. Branch Naming Checker

  • Trigger: If the author tries to merge directly from a generically named branch (like main, master, or patch-1).
  • Message: Suggests using descriptive feature branches (like feature/my-new-idea).

11. Merge Conflict Watcher

  • Trigger: If pr.mergeable is evaluated as exactly false.
  • Message: Alerts the author that they have merge conflicts and need to rebase against the target branch.

12. Documentation Praise

  • Trigger: If the PR exclusively modifies *.md files or the docs/ folder.
  • Message: Praises the author as a "Documentation Guardian" for spreading knowledge.

Copilot AI review requested due to automatic review settings April 20, 2026 04:50
@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented Apr 20, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

Copy link
Copy Markdown
Contributor

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

Introduces an automated “HPX PR Sentinel” GitHub Actions workflow to label PRs and post/update a single rule-based review comment to improve contributor guidance and maintainer triage.

Changes:

  • Added a pull_request_target workflow that runs actions/labeler and an actions/github-script rules engine to comment on PR hygiene (title format, WIP, size, tests, changelog, etc.).
  • Added .github/labeler.yml with path-based label rules for common areas (cmake, docs, core/full, tests, examples, GitHub actions).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
.github/workflows/hpx-pr-bot.yml New PR bot workflow that labels PRs and posts/updates an automated review comment based on heuristic checks.
.github/labeler.yml New labeler configuration mapping changed paths to standard labels.

Comment thread .github/workflows/hpx-pr-bot.yml Outdated
Comment thread .github/workflows/hpx-pr-bot.yml Outdated
Comment thread .github/workflows/hpx-pr-bot.yml Outdated
Comment thread .github/labeler.yml Outdated
Comment thread .github/workflows/hpx-pr-bot.yml Outdated
Comment thread .github/workflows/hpx-pr-bot.yml
Comment thread .github/workflows/hpx-pr-bot.yml Outdated
Comment thread .github/workflows/hpx-pr-bot.yml
@arpittkhandelwal arpittkhandelwal force-pushed the feature/hpx-pr-sentinel branch from 87f3ed7 to b2bd93e Compare April 20, 2026 04:57
@arpittkhandelwal
Copy link
Copy Markdown
Contributor Author

pushed an update to fix all the issues raised by Copilot and the security scanner.

The security alert was actually a false positive triggered by the emojis in the script (it flags invisible unicode characters as a Trojan Source risk), so I've stripped all emojis and replaced them with standard bracket formatting like [!] and [+].

I also applied all the fixes Copilot suggested:

Added a concurrency block so multiple pushes don't step on each other.
Handled the GitHub API pagination correctly.
Enhanced the test detection so it stops giving false alarms for tests added under libs/*/tests/.
Tweaked the comment logic to gracefully update to a "looks good" state instead of trying to delete itself.
Fixed the logic gap so it correctly complains about missing changelogs regardless of what happens to docs.

@arpittkhandelwal
Copy link
Copy Markdown
Contributor Author

@hkaiser sir could you please review this PR when you get a chance? Thanks!

Comment thread .github/labeler.yml
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
cmake:
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.

Are these the names of the labels that will be created? If yes, please align with the existing label names (like category: cmake) or similar.

github-token: "${{ secrets.GITHUB_TOKEN }}"
script: |
const pr = context.payload.pull_request;
const botSign = `\n\n---\n*Beep Boop! I am the **HPX PR Sentinel**!*\n*I automatically review pull requests to keep HPX fast and reliable!*`;
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.

Heh, let's keep it professional (i.e. no Beep Boop! please).

@hkaiser
Copy link
Copy Markdown
Contributor

hkaiser commented Apr 26, 2026

@arpittkhandelwal I'm not sure if this kind of hand-holding isn't too restrictive and would put people off rather than encouraging them to follow certain rules (and I'm not sure if this can be done in an automated way to begin with). I'd like to hear what others say to this before making a decision, though. Perhaps starting a discussion on Discord may give us more feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants