General refactoring

This commit is contained in:
Nikolai Laevskii
2023-08-02 06:13:14 +02:00
parent 68124ad53a
commit 3b7f505149
14 changed files with 292 additions and 225 deletions

16
src/api/get-content.ts Normal file
View File

@@ -0,0 +1,16 @@
import * as github from '@actions/github';
import {ClientType} from './types';
export const getContent = async (
client: ClientType,
repoPath: string
): Promise<string> => {
const response: any = await client.rest.repos.getContent({
owner: github.context.repo.owner,
repo: github.context.repo.repo,
path: repoPath,
ref: github.context.sha
});
return Buffer.from(response.data.content, response.data.encoding).toString();
};