generated from ubiquity/ts-template
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from gentlementlegen/feat/configuration
feat: configuration is now fetched from Ubiquibot package
- Loading branch information
Showing
38 changed files
with
570 additions
and
295 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,9 @@ name: Run Jest Tests | |
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
branches: | ||
- development | ||
|
||
jobs: | ||
test: | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
export enum CommentType { | ||
/** | ||
* Review related item | ||
*/ | ||
REVIEW = 0b1, | ||
/** | ||
* Issue related item | ||
*/ | ||
ISSUE = 0b10, | ||
/** | ||
* User assigned to the {@link CommentType.ISSUE} or {@link CommentType.REVIEW} | ||
*/ | ||
ASSIGNEE = 0b100, | ||
/** | ||
* The author of the {@link CommentType.ISSUE} or {@link CommentType.REVIEW} | ||
*/ | ||
ISSUER = 0b1000, | ||
/** | ||
* A user that is part of the organization or owner of the repo | ||
*/ | ||
COLLABORATOR = 0b10000, | ||
/** | ||
* A user that is NOT part of the organization nor owner of the repo | ||
*/ | ||
CONTRIBUTOR = 0b100000, | ||
/** | ||
* A user comment action on a {@link CommentType.ISSUE} or {@link CommentType.REVIEW} | ||
*/ | ||
COMMENTED = 0b1000000, | ||
/** | ||
* Pull request opening item | ||
*/ | ||
TASK = 0b10000000, | ||
/** | ||
* Issue opening item | ||
*/ | ||
SPECIFICATION = 0b100000000, | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
import * as fs from "fs"; | ||
import YAML from "yaml"; | ||
import program from "../parser/command-line"; | ||
import { IncentivesConfiguration, incentivesConfigurationSchema, validateIncentivesConfiguration } from "./incentives"; | ||
import { Value } from "@sinclair/typebox/value"; | ||
import { merge } from "lodash"; | ||
|
||
const file = fs.readFileSync(program.opts().config, "utf8"); | ||
const configuration = YAML.parse(file); | ||
let configuration: IncentivesConfiguration | null = null; | ||
|
||
export default configuration; | ||
try { | ||
const defaultConf = Value.Create(incentivesConfigurationSchema); | ||
configuration = Value.Decode(incentivesConfigurationSchema, defaultConf); | ||
} catch (e) { | ||
console.error(e); | ||
} | ||
|
||
if (program.settings) { | ||
const settings = merge(configuration, JSON.parse(program.settings)); | ||
if (validateIncentivesConfiguration.test(settings)) { | ||
configuration = settings; | ||
} else { | ||
console.warn("Invalid incentives configuration detected, will revert to defaults."); | ||
for (const error of validateIncentivesConfiguration.errors(settings)) { | ||
console.warn(error); | ||
} | ||
} | ||
} | ||
|
||
export default configuration as IncentivesConfiguration; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { config } from "dotenv"; | ||
|
||
config(); | ||
export const GITHUB_TOKEN = process.env.GITHUB_TOKEN; | ||
export const OPENAI_API_KEY = process.env.OPENAI_API_KEY; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
import { Static, Type } from "@sinclair/typebox"; | ||
|
||
const contentEvaluatorConfigurationType = Type.Object({ | ||
enabled: Type.Boolean(), | ||
export const contentEvaluatorConfigurationType = Type.Object({ | ||
/** | ||
* Enables or disables this module | ||
*/ | ||
enabled: Type.Boolean({ default: true }), | ||
}); | ||
|
||
export type ContentEvaluatorConfiguration = Static<typeof contentEvaluatorConfigurationType>; | ||
|
||
export default contentEvaluatorConfigurationType; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Type, Static } from "@sinclair/typebox"; | ||
|
||
export const dataPurgeConfigurationType = Type.Object({ | ||
/** | ||
* Enables or disables this module | ||
*/ | ||
enabled: Type.Boolean({ default: true }), | ||
}); | ||
|
||
export type DataPurgeConfiguration = Static<typeof dataPurgeConfigurationType>; |
Oops, something went wrong.
ecd6281
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JUnit
Coverage Report (79%)