Skip to content

Commit

Permalink
Add automatic retries when talking to Github API (#82)
Browse files Browse the repository at this point in the history
  • Loading branch information
nineinchnick committed Jan 3, 2023
1 parent 522da11 commit be8172c
Show file tree
Hide file tree
Showing 4 changed files with 17,499 additions and 12,031 deletions.
5 changes: 4 additions & 1 deletion action.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const core = require('@actions/core');
const github = require('@actions/github');
const { Octokit } = require("@octokit/rest");
const { retry } = require("@octokit/plugin-retry");
const RetryingOctokit = Octokit.plugin(retry);
const { parseTestReports } = require('./utils.js');

const action = async () => {
Expand Down Expand Up @@ -32,7 +35,7 @@ const action = async () => {
const status = 'completed';
const head_sha = commit || (pullRequest && pullRequest.head.sha) || github.context.sha;

const octokit = github.getOctokit(githubToken);
const octokit = new RetryingOctokit({auth: githubToken, request: { retries: 3 }});
if (createCheck) {
core.info(`Posting status '${status}' with conclusion '${conclusion}' to ${link} (sha: ${head_sha})`);
const createCheckRequest = {
Expand Down
Loading

0 comments on commit be8172c

Please sign in to comment.