Skip to content

Commit

Permalink
fix: strip content length if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
gentlementlegen committed Oct 6, 2024
1 parent 7a35900 commit 52a4f42
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { returnDataToKernel } from "./helpers/validator";
import { IssueActivity } from "./issue-activity";
import { getOctokitInstance } from "./octokit";
import program from "./parser/command-line";
import { Processor } from "./parser/processor";
import { Processor, Result } from "./parser/processor";
import { parseGitHubUrl } from "./start";

export async function run() {
Expand All @@ -31,7 +31,19 @@ export async function run() {
}
const processor = new Processor();
await processor.run(activity);
const result = processor.dump();
let result = processor.dump();
if (result.length > 65536) {
const resultObject = JSON.parse(result) as Result;
for (const [key, value] of Object.entries(resultObject)) {
resultObject[key] = {
userId: value.userId,
task: value.task,
permitUrl: value.permitUrl,
total: value.total,
};
}
result = JSON.stringify(resultObject);
}
await returnDataToKernel(process.env.GITHUB_TOKEN, stateId, { result });
return result;
} else {
Expand Down

0 comments on commit 52a4f42

Please sign in to comment.