Skip to content
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

Validate regex expressions #16

Closed
Bullrich opened this issue Jul 13, 2023 · 0 comments · Fixed by #20
Closed

Validate regex expressions #16

Bullrich opened this issue Jul 13, 2023 · 0 comments · Fixed by #20
Assignees

Comments

@Bullrich
Copy link
Contributor

Validate that the regex expressions are valid.

It could probably be something like:

const isValidRegex = (regex:string) => {
  try {
    new RegExp(regex);
    return true;
  } catch(e) {
    return false;
  }
}
@Bullrich Bullrich added this to the Project launch milestone Jul 13, 2023
@Bullrich Bullrich self-assigned this Jul 13, 2023
Bullrich added a commit that referenced this issue Jul 14, 2023
Added handling of the configuration file.

Closes #5

This adds the field to the action file to look for the configuration
file so we can set a different field, and defaults to
`.github/review.yml`.

Created the basic type for the configuration file.

This adds the:
- rules array
  - no rule types yet
  - they accept an array of include and exclude conditions.
-  the `preventReviewRequests`
- has been renamed from `prevent-review-requests` to
`preventReviewRequests`

Created tests to evaluate all this types and validations.

Also created JOI validations for the configuration object. I have
discovered that it still won't be enough in the case that a regex is
invalid, so I added #16 to have visibility of it.

## Miscelanious

### Created the PullRequestApi class

This class will use the default github secret generated by the action.
We will have a second class to handle the teams.

It is mocked in the tests.

### Created the Runner class

This will be the main class that will combine all the other classes and
APIs (basically the `core.ts` file but with proper abstractions).
Bullrich added a commit that referenced this issue Jul 17, 2023
Created method which validates the regex expressions in a configuration.

Closes #16

I want to have a constant error type + a custom error log so I make it
return either a passed status or a failed status + error message so it
can be logged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant