Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prioritize PR checks that don't require REST API calls first #398

Open
charlietsai opened this issue Dec 22, 2023 · 0 comments
Open

Prioritize PR checks that don't require REST API calls first #398

charlietsai opened this issue Dec 22, 2023 · 0 comments

Comments

@charlietsai
Copy link

charlietsai commented Dec 22, 2023

Similar to #305, I'm looking into ways to reduce API calls made.

I can see here in prNeedsUpdate:

async prNeedsUpdate(pull: PullRequest): Promise<boolean> {

that we have this API call this.octokit.rest.repos.compareCommitsWithBasehead relatively early on:

try {
const { data: comparison } =
await this.octokit.rest.repos.compareCommitsWithBasehead({
owner: pull.head.repo.owner.login,
repo: pull.head.repo.name,
// This base->head, head->base logic is intentional, we want
// to see what would happen if we merged the base into head not
// vice-versa. This parameter expects the format {base}...{head}.
basehead: `${pull.head.label}...${pull.base.label}`,
});

We don't check for PR_READY_STATE and PR_FILTER until further down, so this API call is made for all PRs that are still open. However, many of these checks would have returned false early on if they were checked first.

I don't think compareCommitsWithBasehead needs to run unless all the conditions pass? Could we change it so that it doesn't run until the end?

@charlietsai charlietsai changed the title Prioritize PR checks that don't require REST API call first Prioritize PR checks that don't require REST API calls first Dec 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant