Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ https://github.com/actions/toolkit/blob/master/docs/action-versioning.md

## Contributing

### Development Guide on this fork

- `node_modules` and `dist` are source controlled because it's needed for github actions. Alternatively, we could use something like `@vercel/ncc` in future to avoid this.
- To develop:
- Install yarn: `npm install -g yarn`
- When done, run `yarn format && yarn lint && yarn build`
- If you make any changes to dependencies, use `yarn install --frozen-lockfile`
- Check in changes to `/src`, `/dist`, and any relevant changes to node_modules and lockfile

### Other

If you feel like an improvement could be made, please open an issue in the PyTorch Lightning repository instead.

https://github.com/PyTorchLightning/pytorch-lightning
Expand Down
28 changes: 26 additions & 2 deletions dist/check-group/core/generate_progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ var generateProgressDetailsCLI = function (subprojects, postedChecks) {
};
exports.generateProgressDetailsCLI = generateProgressDetailsCLI;
var generateProgressDetailsMarkdown = function (subprojects, postedChecks) {
var TOTAL_PATHS_CHAR_BUDGET = 50000;
var PATHS_SOFT_CHAR_LIMIT = 1000;
var perSubjectPathCharSoftLimit = Math.min(PATHS_SOFT_CHAR_LIMIT, Math.max(100, Math.floor(TOTAL_PATHS_CHAR_BUDGET / (subprojects.length || 1))));
var progress = "## Groups summary\n\n";
subprojects.forEach(function (subproject) {
// get the aggregated status of all statuses in the subproject
Expand All @@ -131,7 +134,20 @@ var generateProgressDetailsMarkdown = function (subprojects, postedChecks) {
var mark = statusToMark(check, postedChecks);
progress += "| ".concat(link, " | ").concat(status, " | ").concat(mark, " |\n");
});
progress += "\nThese checks are required after the changes to `".concat(subproject.paths.join("`, `"), "`.\n");
var pathsStr = "";
for (var _i = 0, _a = subproject.paths; _i < _a.length; _i++) {
var p = _a[_i];
var entry = pathsStr ? ", `".concat(p, "`") : "`".concat(p, "`");
pathsStr += entry;
if (pathsStr.length > perSubjectPathCharSoftLimit) {
var remaining = subproject.paths.length - (pathsStr.match(/`[^`]+`/g) || []).length;
if (remaining >= 2) {
pathsStr += ", and ".concat(remaining, " more files");
break;
}
}
}
progress += "\nThese checks are required after the changes to ".concat(pathsStr, ".\n");
progress += "\n</details>\n\n";
});
return progress;
Expand All @@ -151,14 +167,22 @@ function formPrComment(result, inputs, subprojects, postedChecks) {
var sortedPostedChecks = Object.fromEntries(Object.keys(postedChecks).sort().map(function (key) { return [key, postedChecks[key]]; }) // Map sorted keys back to their values
);
var progressDetails = (0, exports.generateProgressDetailsMarkdown)(subprojects, sortedPostedChecks);
return (PR_COMMENT_START
var MAX_COMMENT_LENGTH_GITHUB = 65536;
// Add some buffer in case we need it
var MAX_COMMENT_LENGTH = MAX_COMMENT_LENGTH_GITHUB - 1000;
var comment = (PR_COMMENT_START
+ "\n# ".concat(lightning, " Required checks status: ").concat(parsedConclusion, " ").concat(conclusionEmoji, "\n\n")
+ ((hasFailed) ? failedMesage : "")
+ ((subprojects.length) ? progressDetails : "No groups match the files changed in this PR.\n\n")
+ "---\n\n"
+ "Thank you for your contribution! 💜\n\n"
+ "> **Note**\n> This comment is automatically generated and updates for ".concat(inputs.timeout, " minutes every ").concat(inputs.interval, " seconds.")
+ " If you have any other questions, contact `".concat(inputs.owner, "` for help."));
if (comment.length > MAX_COMMENT_LENGTH) {
var suffix = "\n\n---\n\n> **Note**: Comment was truncated because it exceeded GitHub's 65536 character limit.";
comment = comment.slice(0, MAX_COMMENT_LENGTH - suffix.length) + suffix;
}
return comment;
}
function getPrComment(context) {
return __awaiter(this, void 0, void 0, function () {
Expand Down
Loading
Loading