Thanks to visit codestin.com
Credit goes to github.com

Skip to content

conventional-commits - Fix label for messages starting with backtick #8427

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 1 commit into
base: main
Choose a base branch
from

Conversation

loky-lp
Copy link

@loky-lp loky-lp commented May 2, 2025

Apparently, the problem with the label not showing up when the message starts with a backtick, was fault of:

if (commit.raw === textNode.textContent && !commitTitleElement.nextElementSibling) {

The commit.raw and textNode.textContent were identical and no sibling was found because the <code> element is inside commitTitleElement, not as a sibling.
By counting the children, the <code> element or any element should avoid the early return, as text nodes don't count as childElements.

Test URLs

https://github.com/loky-lp/rgh-dummy-conventional-commits/commits/main
https://github.com/refined-github/sandbox/pull/91/commits

Screenshot

Before:
Screenshot 2025-05-02 alle 22 56 03

After:
Screenshot 2025-05-02 alle 22 55 17

Control

Before:
Screenshot 2025-05-02 alle 22 56 35

After:
Screenshot 2025-05-02 alle 22 57 10

Closes: #8223

@fregante
Copy link
Member

fregante commented May 2, 2025

Test URLs

IDK what to put here,

Where did you take the screenshot? That URL.

There are also a number of test URLs at the bottom of the feature's source code. I'd like to see what it looks like on those, particularly on https://github.com/refined-github/sandbox/pull/91/commits. Check the entire list, especially at the bottom.

@fregante fregante added the bug label May 2, 2025
@loky-lp
Copy link
Author

loky-lp commented May 2, 2025

There are also a number of test URLs at the bottom of the feature's source code. I'd like to see what it looks like on those, particularly on refined-github/sandbox#91 (commits). Check the entire list, especially at the bottom.

🤡 <- me

Where did you take the screenshot? That URL.

It's a private company repo, gonna use the urls in the bottom of the file and gonna create a dummy repo

As of this comment the only difference is the fix(for `key`): no backticks
Before:
Screenshot 2025-05-02 alle 21 17 19

After:
Screenshot 2025-05-02 alle 21 17 12

Apart from the duplication, I guess should avoid adding the label when the scope has backticks

@loky-lp loky-lp force-pushed the fix/conventional-commit-label branch from fcac3d6 to 9dbd793 Compare May 2, 2025 20:47
@loky-lp
Copy link
Author

loky-lp commented May 2, 2025

Boi, GH sure do some shenanigans with their markup, i tried to have both code and PR links inside the scope if present, but then settled for the fix.
I would really have liked some easily parsable data from github, like a json besides the markup to avoid parse the entire DOM of a commit, but that's asking too much i guess.

PR updated with my test URL and control screens of the already present test URLs.

@fregante
Copy link
Member

fregante commented May 3, 2025

Yeah that's why the code was written this way, I don't want the feature to support/break the formatting. If the scope contains formatted code, then it's "invalid" according to the spec we're following.

@loky-lp
Copy link
Author

loky-lp commented May 5, 2025

I've updated both the commit and the PR description to adhere to our spec, with example screenshots too

Copy link

@BoomchainLabs BoomchainLabs left a comment

Choose a reason for hiding this comment

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

Lgtm

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

Successfully merging this pull request may close these issues.

conventional-commits: Commit comment starting with a backquote is not supported
3 participants