mirror of
https://github.com/actions/labeler
synced 2026-09-05 11:35:10 +02:00
* feat: migrate to ESM and update dependencies - Migrated the project to ESM to support the latest `@actions/*` package versions. - Updated dependencies to their latest versions, including `@actions/core`, `@actions/github`, and others. - Replaced `.prettierrc.js` with `.prettierrc.json` for configuration. - Updated ESLint configuration to use ESM and added new rules. - Refactored test files to use `jest` with ESM imports. - Removed deprecated files and updated import paths to use `.js` extensions. - Added new files for improved configuration and removed unnecessary mocks. - Updated README to reflect breaking changes in version 7. * docs: update README to clarify ESM migration details and adjust TypeScript configuration
39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import * as core from '@actions/core';
|
|
import * as github from '@actions/github';
|
|
import {getChangedFiles} from './get-changed-files.js';
|
|
import {ClientType} from './types.js';
|
|
|
|
export async function* getPullRequests(
|
|
client: ClientType,
|
|
prNumbers: number[]
|
|
) {
|
|
for (const prNumber of prNumbers) {
|
|
core.debug(`looking for pr #${prNumber}`);
|
|
let prData: any;
|
|
try {
|
|
const result = await client.rest.pulls.get({
|
|
owner: github.context.repo.owner,
|
|
repo: github.context.repo.repo,
|
|
pull_number: prNumber
|
|
});
|
|
prData = result.data;
|
|
} catch {
|
|
core.warning(`Could not find pull request #${prNumber}, skipping`);
|
|
continue;
|
|
}
|
|
|
|
core.debug(`fetching changed files for pr #${prNumber}`);
|
|
const changedFiles: string[] = await getChangedFiles(client, prNumber);
|
|
if (!changedFiles.length) {
|
|
core.warning(`Pull request #${prNumber} has no changed files, skipping`);
|
|
continue;
|
|
}
|
|
|
|
yield {
|
|
data: prData,
|
|
number: prNumber,
|
|
changedFiles
|
|
};
|
|
}
|
|
}
|