Skip to content

ci: ensure pull request follow conventional commits spec - #11840

Merged
pkuczynski merged 4 commits into
masterfrom
ci/semantic-pr
Jan 8, 2026
Merged

pkuczynski merged 4 commits into
masterfrom
ci/semantic-pr

Conversation

@pkuczynski

Copy link
Copy Markdown
Member

Ensures that pull request titles match the Conventional Commits spec

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 Security concerns

Potential security concern with pull_request_target:
This trigger runs workflows in the context of the target repository with write permissions and access to secrets, even for PRs from untrusted forks. While the current workflow only validates PR titles using a third-party action and doesn't execute code from the PR, this could become a security risk if the workflow is modified in the future to checkout PR code or run untrusted scripts. The permissions block correctly limits access to pull-requests: read, which is good practice. Ensure that future modifications to this workflow do not introduce code execution from the PR context.

⚡ Recommended focus areas for review

Security Risk

Using pull_request_target trigger can be dangerous as it runs in the context of the base repository with access to secrets, even for PRs from forks. Since this workflow only validates PR titles and doesn't execute any code from the PR, this is acceptable. However, ensure no future modifications execute untrusted code from the PR.

pull_request_target:
  types:
    - opened
    - edited
    - synchronize
Pattern Validation

The subjectPattern regex allows various special characters but may be too permissive. Consider whether characters like backticks, asterisks, and parentheses in commit subjects align with the project's commit message standards and don't introduce any edge cases.

subjectPattern: ^[a-z][a-zA-Z0-9 \-\/()*.@,_`']+$
subjectPatternError: |

@qodo-free-for-open-source-projects

qodo-free-for-open-source-projects Bot commented Dec 9, 2025 •

Copy link
Copy Markdown

PR Code Suggestions ✨

Latest suggestions up to 9b7cfa9

CategorySuggestion                                                                                                                                    Impact
Security
Document pull_request_target usage rationale

Add a comment to explain the use of pull_request_target, clarifying why it is
necessary for this workflow and confirming its safety in this specific context.

.github/workflows/pull-request.yml [3-8]

 on:
+  # Using pull_request_target to access GITHUB_TOKEN with read permissions
+  # Safe here as we only validate PR titles without code checkout
   pull_request_target:
     types:
       - opened
       - edited
       - synchronize
  • Apply / Chat
Suggestion importance[1-10]: 7

__

Why: The suggestion correctly identifies the security implications of using pull_request_target and proposes adding a clarifying comment. This significantly improves the workflow's maintainability and security transparency for future contributors.

Medium
Remove potentially unsafe special characters

Remove backticks and single quotes from the subjectPattern regex to mitigate
potential injection risks during commit message processing.

.github/workflows/pull-request.yml [29]

-subjectPattern: ^[a-z][a-zA-Z0-9 \-\/()*.@,_`']+$
+subjectPattern: ^[a-z][a-zA-Z0-9 \-\/()*.@,_]+$
  • Apply / Chat
Suggestion importance[1-10]: 5

__

Why: This is a valid security hardening suggestion. While the actual risk of an injection attack is low in this context, restricting the character set in the PR title regex to only what is necessary is good practice and reduces the potential attack surface.

Low
  • More

Previous suggestions

Suggestions up to commit 6570d71
CategorySuggestion                                                                                                                                    Impact
Security
Remove potentially unsafe characters from pattern

Remove backticks and single quotes from the subjectPattern regex to mitigate
potential injection risks.

.github/workflows/pull-request.yml [29]

-subjectPattern: ^[a-z][a-zA-Z0-9 \-\/()*.@,_`']+$
+subjectPattern: ^[a-z][a-zA-Z0-9 \-\/()*.@,_]+$
Suggestion importance[1-10]: 2

__

Why: The suggestion to remove backticks and single quotes from the subjectPattern is overly cautious, as it would restrict legitimate commit messages for a very low and hypothetical security risk within the context of the amannn/action-semantic-pull-request action.

Low
Suggestions up to commit a4ff8b9
CategorySuggestion                                                                                                                                    Impact
Security
Remove potentially unsafe characters from pattern

To enhance security, consider removing backticks and single quotes from the
subjectPattern regex to prevent potential injection or parsing issues.

.github/workflows/pull-request.yml [29]

-subjectPattern: ^[a-z][a-zA-Z0-9 \-\/()*.@,_`']+$
+subjectPattern: ^[a-z][a-zA-Z0-9 \-\/()*.@,_]+$
Suggestion importance[1-10]: 4

__

Why: The suggestion correctly identifies that allowing backticks and single quotes in the regex is permissive, but the risk of an injection attack within the context of the amannn/action-semantic-pull-request action is low, as it primarily performs validation.

Low
Suggestions up to commit a68ca09
CategorySuggestion                                                                                                                                    Impact
Possible issue
Allow single-character pull request subjects

Modify the subjectPattern regex to allow single-character pull request subjects
by changing the + quantifier to *.

.github/workflows/pull-request.yml [29]

-subjectPattern: ^[a-z][a-zA-Z0-9 \-\/()*.@,_`']+$
+subjectPattern: ^[a-z][a-zA-Z0-9 \-\/()*.@,_`']*$
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly identifies that the regex for subjectPattern disallows single-character subjects and proposes a valid change to allow them, which can be a minor improvement for flexibility.

Low

@gioboa gioboa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks great to me 👍

Comment thread .github/workflows/pull-request.yml Resolved
Updated error message for pull request title validation to clarify requirements.

@gioboa gioboa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM 👏

@gioboa
gioboa requested a review from naorpeled December 10, 2025 13:49
@mguida22

Copy link
Copy Markdown
Collaborator

This seems a bit heavy handed to me. I would rather encourage contributions and leave it to maintainers to edit PR titles as needed (without a failing check)

@naorpeled

Copy link
Copy Markdown
Member

This seems a bit heavy handed to me. I would rather encourage contributions and leave it to maintainers to edit PR titles as needed (without a failing check)

+1

@pkuczynski

Copy link
Copy Markdown
Member Author

This seems a bit heavy handed to me. I would rather encourage contributions and leave it to maintainers to edit PR titles as needed (without a failing check)

It's linting like any other. Just this time it's linting PR and not the code. Seems very reasonable thing for me to do. I took this one from vite and faker actually, but I have seen this on many other repos too...

@michaelbromley

Copy link
Copy Markdown
Member

I just checked the contributing guide and I couldn't clearly see an instruction on the PR name convention in particular. There is a detailed section on commit message format, but it's not necessarily obvious that the PR name must follow that. So we should also make the expectation explicit there, with an example.

I'm personally OK with this change - with the amount of external contributions we get, it will at least keep things consistent.

When the workflow fails, does it also add a comment to the PR thread with the error?

@pkuczynski

Copy link
Copy Markdown
Member Author

No, it does not add a comment, but PR owner would get an email with failed build notification. Maintainers will see it too. And we should add this workflow to pass as part of branch protection rules.

Let me update the contribution guidelines to stay consistent.

@pkuczynski

Copy link
Copy Markdown
Member Author

I double checked and other popular repos do not add comment. Possibly to avoid the noise.

This action documentation does show example how to add a comment when it fails (and remove when fixed), but I am not sure if this is worth the effort. I was 50/50 on this, and eventually decided not to do it. Let me know if you think otherwise...

G0maa
G0maa previously requested changes Dec 13, 2025

@G0maa G0maa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should probably update CONTRIBUTING.md to reflect this.

@G0maa

G0maa commented Dec 13, 2025

Copy link
Copy Markdown
Collaborator

I’m neutral on this change; we could always test it and see if it makes people’s lives harder, then remove it 😀

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jan 8, 2026 •

Copy link
Copy Markdown

Deploying typeorm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6570d71
Status: ✅  Deploy successful!
Preview URL: https://f5296cd2.typeorm.pages.dev
Branch Preview URL: https://ci-semantic-pr.typeorm.pages.dev

View logs

@gioboa
gioboa requested a review from alumni January 8, 2026 08:50
@gioboa
gioboa requested a review from G0maa January 8, 2026 15:28
@gioboa
gioboa dismissed G0maa’s stale review January 8, 2026 15:29

I asked for a new review

@pkuczynski
pkuczynski merged commit 8718e3d into master Jan 8, 2026
18 checks passed
@pkuczynski
pkuczynski deleted the ci/semantic-pr branch January 8, 2026 15:32
mgohin pushed a commit to mgohin/typeorm that referenced this pull request Jan 15, 2026
kranners pushed a commit to kranners/typeorm that referenced this pull request Mar 1, 2026
@pkuczynski pkuczynski added this to the 1.0 milestone Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

7 participants