chore(pr-title): This title should pass pr title checks#124
chore(pr-title): This title should pass pr title checks#124chris3ware merged 21 commits intoci-pr-titlefrom
Conversation
|
The default error message from the pr-title action is not very helpful when the PR title is too long. (it just displays the message advising about the conventional syntax). Going to try and add a custom message for titles being too many characters. |
a1df029 to
466ebe1
Compare
Add a run step to find the length of the PR title. This will be used in a step to display a custom error message if the title is too long. The default error message from the action is not helpful in this case.
466ebe1 to
a4e9bb5
Compare
If the PR title is too long (> 72) then a message is displayed in the PR comment with this information. In all other cases, the error message from the action is used.
|
The conditional display of the "too long" error message and the "conventional" error message works - but the formatting of the conventional error needs to be fixed. |
The comment id should be set to the `created_comment_id` if a comment was created, otherwise it should be set to the `previous_comment_id`.
The expression within the code block in the PR comment is being evaluated as a string. The contents of the output should be displayed.
a3d6335 to
3f2a94d
Compare
The conditional logic to dynamically generate the message for the pr comment was too complex. This changes simplifies the logic by setting the variable if the title is too long and using that, or if the title is the correct length, using the error message from the semantic pr action to set the value of the variable. The pr comment action will use whatever the value is set to - no expression required.
This will always evaluate to true as seen in the previous run. The length does not need checking because validate PR only runs when the length is correct. Therefore the comment will be deleted if the syntax follows the conventional specification.
See if this fixes the unexpected token?
|
Propose to split checking the length of the pull request title and checking the conventional syntax into 2 separate jobs. Why? Because there are too many if statements controlling the execution of steps and logic is becoming overly complex. It is also proving extremely difficult to add the error output of the conventional action to an environment variable - later to be used in the pull request comment. This "just works" when added natively as it was previously. Job one, will check the length of the pull request title and add a comment to the PR if the length is too long. ✅ No complicated flow control logic on each step |
This simplifies the workflow by creating a separate job to check the PR title length. The validation job will only run if this job does not exit. The logic before with regex and if statements was too complex.



PR to test the regex patterns in the pr-title action. The following need to be tested: