GenerateSponsorsYamlFileJob: stable branch, reuse PR & extract GitHubPusher#132
Merged
GenerateSponsorsYamlFileJob: stable branch, reuse PR & extract GitHubPusher#132
Conversation
Previously each edit created a new branch (sponsor-app/<history_id>) and PR, leaving stale PRs open. Now uses a stable branch per conference (sponsor-app/<slug>) and reuses the existing open PR. - Staleness check: skip push if branch already has newer editing history data - Optimistic concurrency: retry on blob_sha conflict when our data is fresher, bail otherwise - PR reuse: find existing open PR on the branch and update its title, with race-condition handling on create Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Separate data generation from GitHub interaction by moving push_to_github internals (branch reset, commit with retry, staleness check, PR upsert) into a nested GitHubPusher PORO. The pusher takes explicit constructor args instead of relying on job instance variables. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
||
| def commit_content | ||
| begin | ||
| blob_sha = octokit.contents(@repo.name, path: @filepath)[:sha] |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
Comment on lines
+232
to
+235
| rescue Octokit::UnprocessableEntity | ||
| # Concurrent job already created PR | ||
| existing_prs = octokit.pull_requests(@repo.name, state: 'open', head: "#{owner}:#{@branch_name}") | ||
| octokit.update_pull_request(@repo.name, existing_prs[0][:number], title: @pr_title) if existing_prs.any? |
This comment was marked as outdated.
This comment was marked as outdated.
Sorry, something went wrong.
The old check only compared last_editing_history, so event-only changes could overwrite newer branch data (or skip when they shouldn't). Always emit both IDs in the YAML comment (defaulting to 0) and compare both with domination logic: branch is newer only when both IDs are >= ours and at least one is strictly >. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Without ref:, the API defaults to the repo's default branch, which differs from base_branch when the conference specifies a custom branch. This caused a guaranteed conflict on the first update_contents attempt, wasting a retry. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
sorah
added a commit
that referenced
this pull request
Mar 2, 2026
Deleting and recreating the branch causes GitHub to close the associated PR. Force-updating has the same effect on PR history. Instead, only create the branch when it doesn't exist and commit on top, so the PR stays open and accumulates commits naturally. follow-up: #132 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously each edit created a new branch (
sponsor-app/<history_id>) and PR, leaving stale PRs open. Now uses a stable branch per conference (sponsor-app/<slug>) and reuses the existing open PR.Second commit extracts the push-to-GitHub logic (branch reset, commit with retry, staleness check, PR upsert) into a nested
GitHubPusherPORO, separating data generation from GitHub interaction.