Skip to content

create-tag: switch GitHub API from REST to GraphQL#43

Merged
ochosi merged 1 commit into
create-tagfrom
improve-speed
May 21, 2026
Merged

create-tag: switch GitHub API from REST to GraphQL#43
ochosi merged 1 commit into
create-tagfrom
improve-speed

Conversation

@ochosi
Copy link
Copy Markdown
Contributor

@ochosi ochosi commented May 21, 2026

Replace per-commit REST API calls (ghapi) with batched GitHub GraphQL queries, reducing ~100+ HTTP requests and 60+ seconds of mandatory sleep to 1-3 requests with no sleeps.

Benchmarked against osbuild/osbuild-composer:

23 commits (v170..v171): 111 API calls / 100.3s → 1 call / 1.2s (81.6x)
7 commits (v171..v172): 34 API calls / 27.3s → 1 call / 0.9s (31.6x)
3 image tags: 6 API calls / 5.2s → 1 call / 0.4s (11.7x)

Summary

  • Images changelog output is byte-identical.
  • PR coverage is a strict superset (GraphQL associatedPullRequests finds PRs that the REST search index occasionally misses).
  • Author name resolution for bot accounts is also fixed (REST/ghapi returned '{}' instead of falling back to login).

Replace per-commit REST API calls (ghapi) with batched GitHub GraphQL
queries, reducing ~100+ HTTP requests and 60+ seconds of mandatory
sleep to 1-3 requests with no sleeps.

Benchmarked against osbuild/osbuild-composer:

  23 commits (v170..v171): 111 API calls / 100.3s → 1 call / 1.2s (81.6x)
   7 commits (v171..v172):  34 API calls /  27.3s → 1 call / 0.9s (31.6x)
   3 image tags:             6 API calls /   5.2s → 1 call / 0.4s (11.7x)

Images changelog output is byte-identical. PR coverage is a strict
superset (GraphQL associatedPullRequests finds PRs that the REST search
index occasionally misses). Author name resolution for bot accounts is
also fixed (REST/ghapi returned '{}' instead of falling back to login).

Co-authored-by: Cursor <cursoragent@cursor.com>
@ochosi ochosi requested a review from thozza May 21, 2026 09:17
Copy link
Copy Markdown
Member

@thozza thozza left a comment

Choose a reason for hiding this comment

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

Amazing. Tested locally, it seems to work and it is fast as hell... 👍

Comment thread create_tag.py
Comment on lines +212 to +214
except Exception as e:
msg_info(f"GraphQL request failed for batch: {e}")
continue
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Note that in case of an error (could be a transient network issue), the continue will drop a whole batch of commits and the final pushed tag will be incomplete. It may make more sense to hard fail in such a case or catch a more specific exception.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Darn, didn't see that comment in time for the merge, but will create a follow-up.

@ochosi ochosi merged commit db8024a into create-tag May 21, 2026
@ochosi ochosi deleted the improve-speed branch May 21, 2026 19:42
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.

2 participants