Skip to content

Commit 8b17068

Browse files
committed
README.md: Add openai-api-key to sensitive information masking; codex.ts: remove commented code; github.ts: truncate output for PR comments and body
1 parent 8b03fa0 commit 8b17068

3 files changed

Lines changed: 18 additions & 6 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,4 @@ Claude Code or Codex will analyze the request and create a new Pull Request with
152152
## Security
153153

154154
* **Permission Checks:** Before executing core logic, the action verifies if the triggering user (`github.context.actor`) has `write` or `admin` permissions for the repository.
155-
* **Sensitive Information Masking:** Any occurrences of the provided `github-token` and `anthropic-api-key`, `AWS Credentials` within the output posted to GitHub are automatically masked (replaced with `***`) to prevent accidental exposure.
155+
* **Sensitive Information Masking:** Any occurrences of the provided `github-token` and `anthropic-api-key`, `AWS Credentials`, `openai-api-key` within the output posted to GitHub are automatically masked (replaced with `***`) to prevent accidental exposure.

src/client/codex.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ export async function runCodex(workspace: string, config: ActionConfig, prompt:
7272
textResult = jsonResult.content[0].text + '\n\n';
7373
}
7474

75-
return textResult + "<details><summary>Codex Result</summary>\n\n" + codeResult + "\n</details>";
75+
// return textResult + "<details><summary>Codex Result</summary>\n\n" + codeResult + "\n</details>";
76+
return textResult;
7677

7778
} catch (error) {
7879
// Log the full error for debugging, check for timeout

src/github/github.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ export async function createPullRequest(
262262
title: `${commitMessage}`,
263263
head: branchName,
264264
base: baseBranch, // Use the default branch as base
265-
body: `Applied changes based on Issue #${issueNumber}.\n\n${output}`,
265+
body: `Applied changes based on Issue #${issueNumber}.\n\n${truncateOutput(output)}`,
266266
maintainer_can_modify: true,
267267
});
268268

@@ -371,7 +371,7 @@ export async function postComment(
371371
await octokit.rest.issues.createComment({
372372
...repo,
373373
issue_number: issueNumber,
374-
body: body,
374+
body: truncateOutput(body),
375375
});
376376
core.info(`Comment posted to Issue/PR #${issueNumber}`);
377377
} else if ('pull_request' in event) {
@@ -385,7 +385,7 @@ export async function postComment(
385385
...repo,
386386
pull_number: prNumber,
387387
comment_id: inReplyTo ?? commentId, // Use the original comment ID if no reply
388-
body: body,
388+
body: truncateOutput(body),
389389
});
390390
core.info(`Comment posted to PR #${prNumber} Reply to comment #${commentId}`);
391391

@@ -396,7 +396,7 @@ export async function postComment(
396396
await octokit.rest.issues.createComment({
397397
...repo,
398398
issue_number: prNumber,
399-
body: body,
399+
body: truncateOutput(body),
400400
});
401401
core.info(`Regular comment posted to PR #${prNumber}`);
402402
}
@@ -631,3 +631,14 @@ async function getPullRequestData(
631631
throw new Error(`Could not retrieve data for pull request #${pullNumber}: ${error instanceof Error ? error.message : error}`);
632632
}
633633
}
634+
635+
636+
// Truncate the output if it exceeds 60000 characters
637+
// GitHub API has a limit of 65536 characters for the body of a PR
638+
function truncateOutput(output: string): string {
639+
if (output.length > 60000) {
640+
core.warning(`Output exceeds 60000 characters, truncating...`);
641+
return output.substring(0, 60000);
642+
}
643+
return output;
644+
}

0 commit comments

Comments
 (0)