mirror of
https://github.com/actions/labeler.git
synced 2025-12-12 04:27:34 +00:00
25 lines
679 B
TypeScript
25 lines
679 B
TypeScript
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;
|
|
};
|