Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pngwn committed Aug 6, 2024
1 parent d33d647 commit 85e34eb
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions packages/filter-paths/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,28 @@ async function run() {
const filter = filters[filter_name];

let files: any[] = [];
for await (const response of octokit.paginate.iterator(
octokit.rest.pulls.listFiles,
{

if (context.payload.event_name === "pull_request") {
for await (const response of octokit.paginate.iterator(
octokit.rest.pulls.listFiles,
{
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request?.number as number,
per_page: 100,
}
)) {
files = [...files, ...parse_data(response.data)];
}
} else if (context.payload.event_name === "push") {
const response = await octokit.rest.repos.getCommit({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request?.number as number,
per_page: 100,
}
)) {
files = [...files, ...parse_data(response.data)];
ref: context.ref,
});
files = [...files, ...parse_data(response.data.files)];
} else {
throw new Error("Unsupported event");
}

files = files.map((f) => f.filename);
Expand Down

0 comments on commit 85e34eb

Please sign in to comment.