Skip to content

Commit

Permalink
fix: added redactPrivateRepoComments
Browse files Browse the repository at this point in the history
  • Loading branch information
sshivaditya committed Oct 1, 2024
1 parent 31773f4 commit 5f64e28
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ To set up the `.dev.vars` file, you will need to provide the following variables
matchThreshold: 0.95
warningThreshold: 0.75
jobMatchingThreshold: 0.75
redactPrivateRepoComments: false
```
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/add-comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function addComments(context: Context) {
const markdown = payload.comment.body;
const authorId = payload.comment.user?.id || -1;
const nodeId = payload.comment.node_id;
const isPrivate = payload.repository.private;
const isPrivate = context.config.redactPrivateRepoComments ? false : payload.repository.private;
const issueId = payload.issue.node_id;

try {
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/add-issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export async function addIssue(context: Context) {
const markdown = payload.issue.body + " " + payload.issue.title || null;
const authorId = payload.issue.user?.id || -1;
const nodeId = payload.issue.node_id;
const isPrivate = payload.repository.private;
const isPrivate = !context.config.redactPrivateRepoComments && payload.repository.private;

try {
if (!markdown) {
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/update-comments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export async function updateComment(context: Context) {
} = context;
const { payload } = context as { payload: CommentPayload };
const nodeId = payload.comment.node_id;
const isPrivate = payload.repository.private;
const isPrivate = !context.config.redactPrivateRepoComments && payload.repository.private;
const markdown = payload.comment.body || null;
// Fetch the previous comment and update it in the db
try {
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/update-issue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function updateIssue(context: Context) {
const { payload } = context as { payload: IssuePayload };
const payloadObject = payload;
const nodeId = payload.issue.node_id;
const isPrivate = payload.repository.private;
const isPrivate = !context.config.redactPrivateRepoComments && payload.repository.private;
const markdown = payload.issue.body + " " + payload.issue.title || null;
// Fetch the previous issue and update it in the db
try {
Expand Down
1 change: 1 addition & 0 deletions src/types/plugin-inputs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const pluginSettingsSchema = T.Object(
matchThreshold: T.Number({ default: 0.95 }),
warningThreshold: T.Number({ default: 0.75 }),
jobMatchingThreshold: T.Number({ default: 0.75 }),
redactPrivateRepoComments: T.Boolean({ default: false }),
},
{ default: {} }
);
Expand Down
1 change: 1 addition & 0 deletions tests/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ describe("Plugin tests", () => {
warningThreshold: 0.75,
matchThreshold: 0.95,
jobMatchingThreshold: 0.95,
redactPrivateRepoComments: false,
},
adapters: {} as Context["adapters"],
logger: new Logs("debug"),
Expand Down

0 comments on commit 5f64e28

Please sign in to comment.