Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update distribution #169

Merged
merged 1 commit into from
Apr 25, 2023
Merged
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
44 changes: 5 additions & 39 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __asyncValues = (this && this.__asyncValues) || function (o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
};
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.findComment = exports.findCommentPredicate = void 0;
const github = __importStar(__nccwpck_require__(5438));
Expand All @@ -68,7 +61,6 @@ function findCommentPredicate(inputs, comment) {
}
exports.findCommentPredicate = findCommentPredicate;
function findComment(inputs) {
var _a, e_1, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
const octokit = github.getOctokit(inputs.token);
const [owner, repo] = inputs.repository.split('/');
Expand All @@ -77,39 +69,13 @@ function findComment(inputs) {
repo: repo,
issue_number: inputs.issueNumber
};
if (inputs.direction == 'first') {
try {
for (var _d = true, _e = __asyncValues(octokit.paginate.iterator(octokit.rest.issues.listComments, parameters)), _f; _f = yield _e.next(), _a = _f.done, !_a;) {
_c = _f.value;
_d = false;
try {
const { data: comments } = _c;
// Search each page for the comment
const comment = comments.find(comment => findCommentPredicate(inputs, comment));
if (comment)
return comment;
}
finally {
_d = true;
}
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
}
finally { if (e_1) throw e_1.error; }
}
}
else {
// direction == 'last'
const comments = yield octokit.paginate(octokit.rest.issues.listComments, parameters);
const comments = yield octokit.paginate(octokit.rest.issues.listComments, parameters);
if (inputs.direction == 'last') {
comments.reverse();
const comment = comments.find(comment => findCommentPredicate(inputs, comment));
if (comment)
return comment;
}
const comment = comments.find(comment => findCommentPredicate(inputs, comment));
if (comment)
return comment;
return undefined;
});
}
Expand Down