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

Configuration file handling #17

Merged
merged 22 commits into from
Jul 14, 2023
Merged

Configuration file handling #17

merged 22 commits into from
Jul 14, 2023

Conversation

Bullrich
Copy link
Contributor

@Bullrich Bullrich commented Jul 13, 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 Bullrich added this to the Project launch milestone Jul 13, 2023
@Bullrich Bullrich requested a review from a team as a code owner July 13, 2023 14:12
@Bullrich Bullrich self-assigned this Jul 13, 2023
@Bullrich
Copy link
Contributor Author

@mutantcornholio could you please help me with the linting?

I'm having the following issue and I don't know how to properly fix it:

/home/runner/work/review-bot/review-bot/src/test/index.test.ts
  0:0  error  Parsing error: ESLint was configured to run on `<tsconfigRootDir>/src/test/index.test.ts` using `parserOptions.project`: <tsconfigRootDir>/tsconfig.json
You unnecessarily included the extension `.cjs` with the `parserOptions.extraFileExtensions` option. This extension is already handled by the parser by default.

/home/runner/work/review-bot/review-bot/src/test/logger.ts
Error:   1:1  error  '../github/types' import is restricted from being used by a pattern  no-restricted-imports

/home/runner/work/review-bot/review-bot/src/test/runner/config.test.ts
  0:0  error  Parsing error: ESLint was configured to run on `<tsconfigRootDir>/src/test/runner/config.test.ts` using `parserOptions.project`: <tsconfigRootDir>/tsconfig.json
You unnecessarily included the extension `.cjs` with the `parserOptions.extraFileExtensions` option. This extension is already handled by the parser by default.

Thanks!

package.json Outdated Show resolved Hide resolved
src/test/runner/config.test.ts Outdated Show resolved Hide resolved
@Bullrich Bullrich requested review from a team and mutantcornholio July 13, 2023 16:06
Copy link
Contributor

@rzadp rzadp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a good start to me.

src/file/validator.ts Outdated Show resolved Hide resolved
src/runner.ts Outdated Show resolved Hide resolved
src/test/logger.ts Show resolved Hide resolved
@Bullrich Bullrich requested a review from mutantcornholio July 14, 2023 10:25
The compiler is complaining that the tests are not inside the src directory. That is frustrating
src/runner.ts Show resolved Hide resolved
Copy link
Contributor

@mutantcornholio mutantcornholio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@Bullrich Bullrich merged commit 3178c22 into main Jul 14, 2023
@Bullrich Bullrich deleted the bullrich/parse-file branch July 14, 2023 14:26
Bullrich added a commit that referenced this pull request Aug 16, 2023
Added an output to the action.

It will return a stringified JSON.

Resolves #17 and #43
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 this pull request may close these issues.

Get and parse configuration file
3 participants