Skip to content

Commit

Permalink
chore(build): update dist/index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
AriPerkkio authored and actions-user committed Aug 25, 2021
1 parent 71dbfed commit a6174c3
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5771,24 +5771,35 @@ try {
}
var GithubClient = class {
constructor() {
this.MAX_RETRIES = 5;
this.octokit = import_github.getOctokit(githubToken);
}
async requestAndRetry(request) {
for (let retryCount = 1; retryCount <= this.MAX_RETRIES; retryCount++) {
try {
return await request();
} catch (error2) {
core.info(`Request failed. Retrying ${retryCount}/${this.MAX_RETRIES}.`);
}
}
return await request();
}
async postResults(body) {
const existingIssue = await this.getExistingIssue();
if (existingIssue === void 0) {
core.info("No existing issue found. Creating new one.");
return this.createIssue(body);
}
core.info(`Reusing existing issue #${existingIssue}`);
await this.octokit.issues.createComment({
await this.requestAndRetry(() => this.octokit.issues.createComment({
owner: import_github.context.repo.owner,
repo: import_github.context.repo.repo,
issue_number: existingIssue,
body
});
}));
}
async getExistingIssue() {
const response = await this.octokit.search.issuesAndPullRequests({
const response = await this.requestAndRetry(() => this.octokit.search.issuesAndPullRequests({
sort: "created",
order: "desc",
q: [
Expand All @@ -5797,19 +5808,19 @@ var GithubClient = class {
"is:open",
`repo:${import_github.context.repo.owner}/${import_github.context.repo.repo}`
].join(" ")
});
}));
const {items} = response.data;
core.info(`Found ${items.length} open issues with title ${issueTitle}`);
const issue = items.find((a) => a.title === issueTitle);
return issue ? issue.number : void 0;
}
async createIssue(body) {
await this.octokit.issues.create({
await this.requestAndRetry(() => this.octokit.issues.create({
owner: import_github.context.repo.owner,
repo: import_github.context.repo.repo,
title: issueTitle,
body
});
}));
}
};
var github_client_default = new GithubClient();
Expand Down

0 comments on commit a6174c3

Please sign in to comment.