Skip to content

Conversation

@Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Jan 12, 2026

This optimises the action to check if a pull request in the merge queue can be skipped by removing the need for actions/checkout with fetch-depth: 0. Instead of fetching the full history and using local git commands, we can use the GitHub API /compare endpoint, which returns a status based on whether the pull request is up-to-date or not.


Note

Optimizes check-skip-merge-queue composite action to avoid full repo fetch and local git.

  • Replaces actions/checkout + shell git merge-base with actions/github-script using the GitHub /compare (compareCommitsWithBasehead) API to determine if PR_BRANCH is identical/ahead of BASE_REF
  • Adds early exit when merge queue position ≠ 1 and sets up-to-date output accordingly
  • Keeps existing outputs while simplifying logic within action.yml

Written by Cursor Bugbot for commit 0ebd25d. This will update automatically on new commits. Configure here.

Copy link
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

basehead: `${BASE_REF}...${PR_BRANCH}`,
});
if (comparison.data.status === 'identical' || comparison.data.status === 'ahead') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what case would it return ahead versus identical?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • identical: The base and head point to the same commit. Not sure when this would be the case, but it's safe to treat pull requests as up-to-date in this case.
  • ahead: The head includes all commits of the base, plus additional commits.
  • behind: The head is missing commits from the base.
  • diverged: Both the head and base contain additional commits compared to the merge base.

@Mrtenz Mrtenz merged commit cda96f4 into main Jan 12, 2026
21 checks passed
@Mrtenz Mrtenz deleted the mrtenz/optimise-up-to-date-check branch January 12, 2026 13:49
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

Successfully merging this pull request may close these issues.

4 participants