mirror of
https://github.com/actions/labeler.git
synced 2025-12-16 06:56:51 +00:00
General refactoring
This commit is contained in:
24
src/api/get-changed-files.ts
Normal file
24
src/api/get-changed-files.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as github from '@actions/github';
|
||||
import {ClientType} from './types';
|
||||
|
||||
export const getChangedFiles = async (
|
||||
client: ClientType,
|
||||
prNumber: number
|
||||
): Promise<string[]> => {
|
||||
const listFilesOptions = client.rest.pulls.listFiles.endpoint.merge({
|
||||
owner: github.context.repo.owner,
|
||||
repo: github.context.repo.repo,
|
||||
pull_number: prNumber
|
||||
});
|
||||
|
||||
const listFilesResponse = await client.paginate(listFilesOptions);
|
||||
const changedFiles = listFilesResponse.map((f: any) => f.filename);
|
||||
|
||||
core.debug('found changed files:');
|
||||
for (const file of changedFiles) {
|
||||
core.debug(' ' + file);
|
||||
}
|
||||
|
||||
return changedFiles;
|
||||
};
|
||||
Reference in New Issue
Block a user