mirror of
https://github.com/Azure/k8s-deploy.git
synced 2026-03-29 02:22:15 +08:00
26 lines
907 B
TypeScript
26 lines
907 B
TypeScript
import * as core from '@actions/core';
|
|
import { WebRequest, WebResponse, sendRequest } from "./utilities/httpClient";
|
|
|
|
export class GitHubClient {
|
|
constructor(repository: string, token: string) {
|
|
this._repository = repository;
|
|
this._token = token;
|
|
}
|
|
|
|
public async getWorkflows(): Promise<any> {
|
|
const getWorkflowFileNameUrl = `https://api.github.com/repos/${this._repository}/actions/workflows`;
|
|
const webRequest = new WebRequest();
|
|
webRequest.method = "GET";
|
|
webRequest.uri = getWorkflowFileNameUrl;
|
|
webRequest.headers = {
|
|
Authorization: `Bearer ${this._token}`
|
|
};
|
|
|
|
core.debug(`Getting workflows for repo: ${this._repository}`);
|
|
const response: WebResponse = await sendRequest(webRequest);
|
|
return Promise.resolve(response);
|
|
}
|
|
|
|
private _repository: string;
|
|
private _token: string;
|
|
}
|