Skip to content

Commit

Permalink
v2.0.3: Do not duplicate results table when there's no other content
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelmhtr committed Aug 3, 2021
1 parent c9776a4 commit c2e7317
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file.

## [2.0.3] - 2021-08-02
### Fixes
- [#7](https://github.com/flowwer-dev/pull-request-stats/issues/7) Do not duplicate results table when there's no other content

## [2.0.2] - 2021-07-22
### Changed
- Ignore pull requests of deleted users (by [Derek Young](https://github.com/derek-young))
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pull-request-stats",
"version": "2.0.2",
"version": "2.0.3",
"description": "Github action to print relevant stats about Pull Request reviewers",
"main": "dist/index.js",
"scripts": {
Expand Down
4 changes: 2 additions & 2 deletions src/interactors/__tests__/alreadyPublished.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const alreadyPublished = require('../alreadyPublished');

const STATS = '\n## Pull reviewers stats\n|stats|table|';
const STATS = '## Pull reviewers stats\n|stats|table|';
const OTHER_CONTENT = '## Other pull request content';

describe('Interactors | .alreadyPublished', () => {
Expand All @@ -23,7 +23,7 @@ describe('Interactors | .alreadyPublished', () => {
});

it('returns true when body contains other stuff and stats', () => {
const body = `${OTHER_CONTENT}${STATS}`;
const body = `${OTHER_CONTENT}\n${STATS}`;
const pullRequest = { body };
expect(alreadyPublished(pullRequest)).toBe(true);
});
Expand Down
2 changes: 1 addition & 1 deletion src/interactors/alreadyPublished.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ const { TABLE_TITLE } = require('../constants');
module.exports = (pullRequest) => {
const { body } = pullRequest || {};

const regexp = new RegExp(`\\n(${TABLE_TITLE})\\n`);
const regexp = new RegExp(`(^|\\n)(${TABLE_TITLE})\\n`);
return regexp.test(body);
};

0 comments on commit c2e7317

Please sign in to comment.