Skip to content

Commit

Permalink
feat: clean revert of revert
Browse files Browse the repository at this point in the history
  • Loading branch information
christophehurpeau committed Apr 24, 2024
1 parent e4e50b2 commit 8870f94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/events/pr-handlers/actions/utils/prTitle.test.ts
Expand Up @@ -55,6 +55,12 @@ describe('cleanTitle', () => {
).toBe('revert: chore(deps): update node.js to v8.14');
});

it('should correct revert of revert', () => {
expect(
cleanTitle('revert: revert: chore(deps): update node.js to v8.14', true),
).toBe('chore(deps): update node.js to v8.14');
});

it('should write correct revert with no issue', () => {
expect(
cleanTitle(
Expand Down
3 changes: 2 additions & 1 deletion src/events/pr-handlers/actions/utils/prTitle.ts
Expand Up @@ -18,5 +18,6 @@ export const cleanTitle = (
.replace(/^([A-Za-z]+)[/:;]\s*/, (s, arg1) => `${arg1.toLowerCase()}: `)
.replace(/\s+(-\s*)?[()[\]]\s*no[\s-]*isss?ue\s*[()[\]]$/i, ' [no issue]')
.replace(/^Revert "([^"]+)"( \[no issue])?$/, 'revert: $1$2')
.replace(/^(revert:.*)(\s+\(#\d+\))( \[no issue])?$/, '$1$3');
.replace(/^(revert:.*)(\s+\(#\d+\))( \[no issue])?$/, '$1$3')
.replace(/^(?:revert: ){2}/, '');
};

0 comments on commit 8870f94

Please sign in to comment.