Skip to content
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

(chore) O3-1109: Added a GitHub Action to check PR titles #1324

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

IamLRBA
Copy link

@IamLRBA IamLRBA commented Mar 24, 2025

Duplicate PR of #1307 (comment)

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. Ensure your PR title includes a conventional commit label (such as feat, fix, or chore, among others). See existing PR titles for inspiration.

For changes to apps

If applicable

  • My work includes tests or is validated by existing tests.
  • I have updated the esm-framework mock to reflect any API changes I have made.

Summary

This PR adds a GitHub Actions workflow to enforce PR title conventions using the amannn/action-semantic-pull-request@v5 action. The workflow checks whether PR titles follow the conventional commit format (feat, fix, docs, or BREAKING:). This ensures consistency in PR naming, improving clarity in commit history and changelogs.

Screenshots

N/A (This is a CI/CD workflow update).

Related Issue

Related Jira issue

Other

This automation will help maintain standardized PR titles across the repository, reducing manual review overhead.

Summary by CodeRabbit

  • Chores
    • Introduced an automated check to ensure pull request titles follow a standardized format, enhancing consistency in contributions.

Copy link

coderabbitai bot commented Mar 24, 2025

Walkthrough

A new GitHub Actions workflow was added to the repository to validate pull request titles. The workflow runs on pull request events—when they are opened, edited, reopened, or synchronized—using an Ubuntu runner. It leverages the amannn/action-semantic-pull-request@v5 action with the repository's GITHUB_TOKEN to check that the PR title adheres to defined semantic patterns including types like docs, test, chore, fix, feat, and BREAKING.

Changes

File(s) Change Summary
.github/workflows/pr-title-check.yml Added new GitHub Actions workflow that triggers on PR events to validate the PR title format using the semantic pull request action.

Sequence Diagram(s)

sequenceDiagram
    participant PR as Pull Request Event
    participant Runner as GitHub Actions Runner (Ubuntu)
    participant Action as Semantic PR Title Action

    PR->>Runner: Trigger on opened, edited, reopened, or synchronized PR
    Runner->>Action: Execute title validation check
    Action-->>Runner: Return result (valid/invalid)
Loading

Poem

I'm a rabbit with a clever knack,
Hopping through code on a brand-new track.
PR titles now must dance in line,
With semantic checks so crisp and fine.
Celebrate the hops in every commit—let's code and have a picnic!
🥕🐇 Happy coding!


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • 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

@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-title-check.yml (1)

22-22: Newline at End of File.
YAMLlint reported a missing newline at the end of the file. Please add a newline character at the end to meet best practices.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 22-22: no new line character at the end of file

(new-line-at-end-of-file)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 2812da6 and 808df66.

📒 Files selected for processing (1)
  • .github/workflows/pr-title-check.yml (1 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
.github/workflows/pr-title-check.yml

[error] 22-22: no new line character at the end of file

(new-line-at-end-of-file)

🔇 Additional comments (6)
.github/workflows/pr-title-check.yml (6)

1-2: Title & Workflow Name is Clear.
The workflow is clearly named "PR Title Checker," which makes its purpose immediately evident.


3-6: Event Triggers are Well-Defined.
The workflow is triggered on relevant pull request events (opened, edited, reopened, synchronize), ensuring that PR title validations occur on all necessary updates.


7-10: Job Definition is Correct.
The job configuration under jobs properly specifies runs-on: ubuntu-latest, which ensures compatibility with the environment required for running the action.


11-13: Step to Check PR Title Format is Configured Correctly.
The step uses the amannn/action-semantic-pull-request@v5 action appropriately to validate the PR title against semantic commit conventions.


14-20: Semantic Commit Types Properly Listed.
The list under types includes docs, test, chore, fix, feat, and BREAKING, which aligns with conventional commit standards. This ensures PR titles will adhere to expected formats.


21-22: Environment Variable is Securely Configured.
The use of the GITHUB_TOKEN from the repository secrets is a secure and standard practice for authenticating GitHub Actions.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 22-22: no new line character at the end of file

(new-line-at-end-of-file)

@IamLRBA
Copy link
Author

IamLRBA commented Mar 24, 2025

@brandones I created this fresh PR on the same issue because the previous had branch conflicts on my local repository. Also there were too many commits on the previous one. I thought one commit having all the changes thus far would be better.

@brandones brandones changed the title chore: O3-1109 Added a GitHub Action to check PR titles (chore) O3-1109: Added a GitHub Action to check PR titles Mar 29, 2025
@brandones
Copy link
Collaborator

Do not open new PRs for the same work if you can possibly avoid it. I understand getting into messes with git branches. Try to learn to use git better. AI can be useful for learning git and debugging messed up git state.

Too many commits is not a problem. They get squashed when a PR is merged anyway. If you have commits locally that you want to squash before you push, you can use an interactive rebase to do that.

@brandones
Copy link
Collaborator

Part of the reason why we don't want PRs closed and replaced with new ones is because we lose the comment and revision history. And you have not fixed the problem I named last time. The check needs to pass with the usual PR title format that the OpenMRS community uses.

My previous comment.

@IamLRBA
Copy link
Author

IamLRBA commented Mar 29, 2025

Do not open new PRs for the same work if you can possibly avoid it. I understand getting into messes with git branches. Try to learn to use git better. AI can be useful for learning git and debugging messed up git state.

Too many commits is not a problem. They get squashed when a PR is merged anyway. If you have commits locally that you want to squash before you push, you can use an interactive rebase to do that.

Thank you for the advice @brandones I really appreciate it and the chance to learn.
These mistakes will not exist the next time.

@IamLRBA
Copy link
Author

IamLRBA commented Mar 29, 2025

Part of the reason why we don't want PRs closed and replaced with new ones is because we lose the comment and revision history. And you have not fixed the problem I named last time. The check needs to pass with the usual PR title format that the OpenMRS community uses.

My previous comment.

The previous PR with the title "(chore) O3-1109: Added a GitHub Action to Check PR titles
(chore) Added a GitHub Action to Check PR titles" had the PR title test failing and when I did some research I discovered the "()" brackets made it fail so I neglected that and this current PR has that particular test passing.

@brandones
Copy link
Collaborator

@IamLRBA Do you understand what the problem is and what I am asking you to do?

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