Comments (5)
hey @mshick, have you made any progress on that? Happy to help if you don't have the bandwidth.
from add-pr-comment.
Interesting issue. I intend to address this by checking the message size and breaking the message into parts if we hit the limit.
I'll make this behavior optional, the default will be to truncate the message with ...
to avoid the error.
from add-pr-comment.
It seems that this 65536 chars is a hard limit https://github.com/orgs/community/discussions/41331 on the gh api
one very interesting this is that this is actually misleading, if you see the following run in the same repo of mine, i am able to pass a 200 KB txt file inside which is higher than 65536 chars (~65 KB)
Links
Screenshot
from add-pr-comment.
We can probably have a function like below to splits the comment into multiple comments based on maxSize
which can be 65536(though in actuality it seems to extend till ~200 KB) and sepEnd
and sepStart
variables can say what must be the separator when the comment gets split into multiple comments
example of sepStart
- Continued from previous comment
example of sepEnd
- Output length greater than max comment size. Continued in next comment.
The return value of this can be used to make multiple calls to the create comment
API. Same can also probably bedone for the message-path
and message-paths
variants
function SplitComment(comment, maxSize, sepEnd, sepStart) {
if (comment.length <= maxSize) {
return [comment];
}
const maxWithSep = maxSize - sepEnd.length - sepStart.length;
const comments = [];
const numComments = Math.ceil(comment.length / maxWithSep);
for (let i = 0; i < numComments; i++) {
const start = i * maxWithSep;
const end = Math.min(comment.length, (i + 1) * maxWithSep);
let portion = comment.substring(start, end);
if (i < numComments - 1) {
portion += sepEnd;
}
if (i > 0) {
portion = sepStart + portion;
}
comments.push(portion);
}
return comments;
}
from add-pr-comment.
Oops, this looks misleading due to me merging a PR on a fork I made to check the tests would pass.
The one line above this comment is the PR I submitted to the actual repository..
from add-pr-comment.
Related Issues (20)
- NODE_ENV log or readme.md update HOT 1
- How to handle multiple PR's? HOT 2
- Encoding pipes? HOT 1
- FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory HOT 1
- Argument list is too long HOT 6
- Removing a comment HOT 2
- Could ```message``` and ```message-path``` be combined HOT 4
- Force-fail the action HOT 2
- Undesired performance with ```update-only``` setting at first run
- [Question] Conditional message depends on steps HOT 1
- Upgrade action to use Node.js 20 to avoid Node.js 16 deprecation HOT 1
- Can the node version upgrade be part of v3? HOT 1
- Comments with references to other PRs
- Bug "Ensure top-level permissions are not set to write-all"
- Change the comment author name HOT 2
- A way to delete the comment
- Support message search and replace
- v2 major tag didn't get updated for v2.4.0 HOT 1
- Allow hiding a comment for repeats and in any case you might want to delete an old comment
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from add-pr-comment.