Skip to content

Commit 1f015a0

Browse files
committed
Fix github action for too long diffs
1 parent f88108a commit 1f015a0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

.github/workflows/munge-pr.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ jobs:
145145
const commentText = 'Diff for ' + context.payload.pull_request.head.sha + ':';
146146
147147
const fs = require('fs');
148-
const diff = fs.readFileSync(process.env.GITHUB_WORKSPACE + '/oi-pr.diff').toString().trimEnd();
148+
var diff = fs.readFileSync(process.env.GITHUB_WORKSPACE + '/oi-pr.diff').toString().trimEnd();
149+
// GitHub has limitation 2^16 of body length
150+
diff = diff < 60000 ? diff : diff.substring(0, 60000) + '\n=== TRUNCATED ===';
149151
var body = "<details>\n<summary>" + commentText + "</summary>\n\n```diff\n" + diff + "\n```\n\n</details>";
150152
const maint = fs.readFileSync(process.env.GITHUB_WORKSPACE + '/oi-pr.maint').toString().trimEnd();
151153
if (maint.length > 0) {

0 commit comments

Comments
 (0)