Vidya reddy/prettier code (#203)

This commit is contained in:
Vidya
2022-06-24 13:57:45 -07:00
committed by GitHub
parent 976c5c4981
commit dcd9bc6b1a
71 changed files with 16044 additions and 15876 deletions
+31 -30
View File
@@ -1,39 +1,40 @@
import * as core from "@actions/core";
import { Octokit } from "@octokit/core";
import { Endpoints } from "@octokit/types";
import { retry } from "@octokit/plugin-retry";
import * as core from '@actions/core'
import {Octokit} from '@octokit/core'
import {Endpoints} from '@octokit/types'
import {retry} from '@octokit/plugin-retry'
export const OkStatusCode = 200;
export const OkStatusCode = 200
const RetryOctokit = Octokit.plugin(retry);
const RETRY_COUNT = 5;
const requestUrl = "GET /repos/{owner}/{repo}/actions/workflows";
const RetryOctokit = Octokit.plugin(retry)
const RETRY_COUNT = 5
const requestUrl = 'GET /repos/{owner}/{repo}/actions/workflows'
type responseType =
Endpoints["GET /repos/{owner}/{repo}/actions/workflows"]["response"];
Endpoints['GET /repos/{owner}/{repo}/actions/workflows']['response']
export class GitHubClient {
private readonly repository: string;
private readonly token: string;
private readonly repository: string
private readonly token: string
constructor(repository: string, token: string) {
this.repository = repository;
this.token = token;
}
constructor(repository: string, token: string) {
this.repository = repository
this.token = token
}
public async getWorkflows(): Promise<responseType> {
const octokit = new RetryOctokit({
auth: this.token,
request: { retries: RETRY_COUNT },
baseUrl: process.env["GITHUB_API_URL"] || "https://api.github.com",
});
const [owner, repo] = this.repository.split("/");
core.debug(`Getting workflows for repo: ${this.repository}`);
return Promise.resolve(
await octokit.request(requestUrl, {
owner,
repo,
// prettier-ignore
public async getWorkflows(): Promise<responseType> {
const octokit = new RetryOctokit({
auth: this.token,
request: {retries: RETRY_COUNT},
baseUrl: process.env["GITHUB_API_URL"] || "https://api.github.com",
})
);
}
const [owner, repo] = this.repository.split('/')
core.debug(`Getting workflows for repo: ${this.repository}`)
return Promise.resolve(
await octokit.request(requestUrl, {
owner,
repo
})
)
}
}