Skip to content

Commit

Permalink
Fix: allow emails in provider map
Browse files Browse the repository at this point in the history
  • Loading branch information
DavideViolante committed Jan 24, 2023
1 parent 21cc3e4 commit cc906fb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
pr-reviews-reminder:
runs-on: ubuntu-latest
steps:
- uses: davideviolante/[email protected].0
- uses: davideviolante/[email protected].1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
3 changes: 2 additions & 1 deletion dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ function createPr2UserArray(pullRequestsToReview) {
*/
function checkGithubProviderFormat(str) {
// Pattern made with the help of ChatGPT
const pattern = /^[A-z0-9_-]+:[A-z0-9_-]+(,\s*[A-z0-9_-]+:[A-z0-9_-]+)*$/m;
const az09 = '[A-z0-9_\\-@\\.]+';
const pattern = new RegExp(`^${az09}:${az09}(,\\s*${az09}:${az09})*$`, 'm');
return pattern.test(str);
}

Expand Down
3 changes: 2 additions & 1 deletion functions.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ function createPr2UserArray(pullRequestsToReview) {
*/
function checkGithubProviderFormat(str) {
// Pattern made with the help of ChatGPT
const pattern = /^[A-z0-9_-]+:[A-z0-9_-]+(,\s*[A-z0-9_-]+:[A-z0-9_-]+)*$/m;
const az09 = '[A-z0-9_\\-@\\.]+';
const pattern = new RegExp(`^${az09}:${az09}(,\\s*${az09}:${az09})*$`, 'm');
return pattern.test(str);
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pr-reviews-reminder-action",
"version": "2.3.0",
"version": "2.3.1",
"description": "Reminder for Pull Request pending reviews",
"scripts": {
"build": "ncc build index.js",
Expand Down
4 changes: 4 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,10 @@ describe('Pull Request Reviews Reminder Action tests', () => {
name3:ID3, name4:ID4,
name5:Id5`));
assert.ok(checkGithubProviderFormat('name1:ID123, name2:ID456'));
assert.ok(checkGithubProviderFormat('name1:[email protected],name2:[email protected]'));
assert.ok(checkGithubProviderFormat('DavideViolante:[email protected], name2:[email protected]'));
assert.ok(checkGithubProviderFormat(`name1:[email protected],
name2:[email protected]`));
assert.ok(!checkGithubProviderFormat('name1ID123,name2:ID456'));
assert.ok(!checkGithubProviderFormat('name1:ID123name2:ID456'));
assert.ok(!checkGithubProviderFormat('name1ID123,name2ID456'));
Expand Down

0 comments on commit cc906fb

Please sign in to comment.