Weekly Upstream Sync Workflow#2
Open
metal-face (metal-face) wants to merge 2 commits into
Open
Conversation
Adds .github/workflows/sync-upstream.yaml. Every Monday at 06:00 UTC (and on-demand via workflow_dispatch) the job fetches juhaku/utoipa, merges upstream/master into a sync/upstream branch with --no-ff so fork-specific commits are preserved, then opens or updates a PR against master. Merge conflicts abort cleanly and open/update a tracking issue with recovery steps instead of pushing broken state. Safeguards: skips push if a human has pushed conflict-resolution commits to an open sync PR; gated to Devolutions/utoipa so forks-of-the-fork don't activate it; falls back to GITHUB_TOKEN if SYNC_PAT is not configured (note: GITHUB_TOKEN-opened PRs do not trigger build.yaml — set SYNC_PAT to get CI on sync PRs). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a scheduled GitHub Actions workflow to keep this fork synced with juhaku/utoipa by periodically merging upstream/master into a dedicated sync/upstream branch and opening/updating a PR back to master, with conflict reporting via a tracking issue.
Changes:
- Introduces
.github/workflows/sync-upstream.yamlscheduled + manual workflow to merge upstream intosync/upstream. - Pushes the sync branch (with
--force-with-lease) and opens/updates async/upstream → masterPR viagh. - On merge conflicts, aborts and creates/comments on a “Upstream sync conflict (…)” issue with recovery steps.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
gh ... --jq '.[0].number' emits the literal string "null" (not an
empty string) when no PRs or issues match, so the existence checks
`[ -n "${VAR}" ]` evaluated true and the next call became
`gh pr edit null` / `gh issue comment null`, which would fail. Add
`// empty` to all three jq expressions so missing values produce no
output and the create-vs-edit branches behave correctly.
Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Adds
.github/workflows/sync-upstream.yaml, a scheduled job that keeps this fork in sync withjuhaku/utoipawhile preserving Devolutions-specific commits onmaster.How it works
workflow_dispatch.git merge --no-ff upstream/masterinto async/upstreambranch built from ourmaster. A merge (not rebase) is used so fork-specific commits are preserved on top via the merge commit, andmaster's history is never rewritten.sync/upstream → master. Branch protection and existing CI onbuild.yamlreview the change before it lands.Conflict handling
If the merge has conflicts the job aborts cleanly — nothing broken is pushed. It instead opens (or comments on an existing) tracking issue titled
Upstream sync conflict (<sha>)with copy-paste recovery commands. A human resolves locally, pushes tosync/upstream, and the PR proceeds normally.Safeguards
--force-with-leaseon the sync branch push, not raw--force.concurrency: sync-upstreamprevents overlapping runs from clashing.if: github.repository == 'Devolutions/utoipa'so forks-of-this-fork don't activate the workflow.Required setup after merge
SYNC_PATsecret (recommended) — a fine-grained PAT scoped to this repo withcontents: write+pull-requests: write+issues: write. Without it the workflow falls back toGITHUB_TOKEN, which works but won't triggerbuild.yamlon the sync PR (GitHub blocksGITHUB_TOKEN-opened PRs from cascading into other workflows). WithSYNC_PATset, CI runs normally on every sync PR.