Skip to content

ci: open upstream sync PRs for the latest stable release - #6

Merged
Project516 merged 3 commits into
masterfrom
ci/upstream-sync-release
Oct 8, 2026
Merged

Project516 merged 3 commits into
masterfrom
ci/upstream-sync-release

Conversation

@Project516

Copy link
Copy Markdown
Owner

Description

  • upstream-sync.yml never opened a PR. It merged upstream develop and exited quietly on any conflict, and every sync since v3.4.1 conflicts. It now follows the same flow as the qbittorrent-warp auto_update.yaml:
    • It tracks the latest upstream stable release, not develop.
    • It merges on a upstream-sync/<tag> branch and opens the PR. A conflicting merge is committed with its markers so the PR shows them, instead of being dropped.
    • It skips a release that is already merged or already has an open PR, so a manual conflict resolution is not overwritten.
    • On a clean merge it arms auto-merge with a merge commit, so upstream history is kept. .github/scripts/arm-automerge.sh refuses to arm unless master has a ruleset requiring a PR and status checks, so nothing merges unchecked.
    • It authenticates with an AUTOUPDATE_TOKEN PAT with the workflow scope. The built-in token cannot push upstream changes to .github/workflows/, and PRs it opens do not trigger CI.
  • .gitignore on master still had conflict markers from the v3.4.1 sync, so git read the marker lines as patterns. It now uses upstream's list plus the fork's config/, committag.json, .env, and *.tsbuildinfo entries.

How Has This Been Tested?

  • actionlint and shellcheck pass on the workflow and the script, and prettier --check passes.
  • The merge, conflict, and PR-body steps match what produced the v3.5.0 sync PR by hand. The PR body passes bin/check-pr-template.mjs rules (Description, How Has This Been Tested, checked contribution box).
  • git status --ignored after a full install and test run lists only node_modules/, config/, .husky/_/, and tsconfig.tsbuildinfo.

Screenshots / Logs (if applicable)

Checklist:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required)

Noticed, not fixed

  • master has no ruleset or branch protection, so clean syncs will open a PR but not arm auto-merge until one exists.
  • The repo has no AUTOUPDATE_TOKEN secret yet, so the workflow fails at its first step until it is added.

@Project516 Project516 mentioned this pull request Oct 8, 2026
6 of 7 tasks
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 6e185ae1-282b-434a-ae67-855e76b2af45
📥 Commits

Reviewing files that changed from the base of the PR and between 8b87b76 and a3826b6.

📒 Files selected for processing (3)
  • .github/scripts/arm-automerge.sh
  • .github/workflows/upstream-sync.yml
  • .gitignore

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: Lint & Test Build
  • GitHub Check: Unit Tests
  • GitHub Check: Analyze (javascript)
🧰 Additional context used
🪛 zizmor (1.30.1)
.github/workflows/upstream-sync.yml

[warning] 40-45: credential persistence through GitHub Actions artifacts (artipacked): does not set persist-credentials: false

(artipacked)


[error] 22-22: overly broad permissions (excessive-permissions): contents: write is overly broad at the workflow level

(excessive-permissions)


[error] 23-23: overly broad permissions (excessive-permissions): pull-requests: write is overly broad at the workflow level

(excessive-permissions)


[warning] 22-22: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment

(undocumented-permissions)

🔇 Additional comments (4)
.github/workflows/upstream-sync.yml (2)

91-91: The force-push can overwrite manual work on the branch of a closed PR.

The open-PR check on Line 73 protects the branch only while its PR is open. Suppose a PR for the same tag was closed without merging. The next run then resets upstream-sync/<tag> to a fresh merge and force-pushes it. That push discards any manual conflict resolution on the branch. If the closed-PR case should keep that work, skip the push when the remote branch already exists. Otherwise, document that this behavior is intended.


5-90: LGTM!

Also applies to: 93-124

.github/scripts/arm-automerge.sh (1)

1-19: LGTM!

.gitignore (1)

32-32: LGTM!

Also applies to: 74-74


📝 Summary

Summary by CodeRabbit

  • Chores
    • The upstream update process now follows the latest stable release and avoids creating duplicate update requests.
    • Updates that merge cleanly can proceed automatically. Updates with conflicts remain open for manual resolution instead of being skipped.
    • Update requests are retried if they cannot be created right away, and automated runs do not interrupt an update already in progress.

Walkthrough

The workflow now syncs stable release tags into master and creates pull requests for clean or conflicted merges. A new script checks branch rules before enabling auto-merge. The .gitignore file also has updated environment and TypeScript build-info rules.

Changes

Stable release sync

Layer / File(s) Summary
Auto-merge rule checks
.github/scripts/arm-automerge.sh
The script checks for pull_request and required_status_checks rules on the base branch. It exits with an error if either rule is missing, skips pull requests that already have auto-merge enabled, and otherwise enables auto-merge.
Stable release workflow
.github/workflows/upstream-sync.yml
The workflow syncs stable release tags on a daily schedule or manual dispatch. It avoids duplicate syncs, creates a tag-specific branch, and creates a pull request for clean or conflicted merges. Pull request creation retries up to 10 times. Clean merges get auto-merge armed; conflicted merges remain open for manual resolution.

Ignore rules

Layer / File(s) Summary
Ignore pattern updates
.gitignore
The file removes an initial conflict-marker block and a trailing conflict marker. It adds .env to the ignored local environment files and changes the TypeScript build-info rule to match all *.tsbuildinfo files.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant UpstreamSyncWorkflow
  participant Git
  participant GitHubCLI
  participant ArmAutomergeScript as arm-automerge.sh
  UpstreamSyncWorkflow->>Git: Check release commit against master
  Git-->>UpstreamSyncWorkflow: Return ancestry result
  UpstreamSyncWorkflow->>Git: Merge release into tag-specific branch
  Git-->>UpstreamSyncWorkflow: Return merge result
  UpstreamSyncWorkflow->>GitHubCLI: Create pull request
  UpstreamSyncWorkflow->>ArmAutomergeScript: Pass clean-merge pull request and method
  ArmAutomergeScript->>GitHubCLI: Check base branch rules and auto-merge state
  GitHubCLI-->>ArmAutomergeScript: Return rules and auto-merge state
  ArmAutomergeScript->>GitHubCLI: Enable auto-merge when needed
Loading

Merge Risk: ⚪ Minimal · up to a3826

No additional merge-blocking issue was established. The documented token and branch-rule prerequisites must be configured before the sync can operate.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: opening upstream sync pull requests for the latest stable release.
Description check ✅ Passed The description directly explains the upstream sync workflow, conflict handling, auto-merge safeguards, authentication, and related .gitignore changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
✨ Simplify code
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

⚠️ This pull request shows signs of AI-generated slop (description_diff_mismatch). It has been flagged by CodeRabbit slop detection and should be reviewed carefully.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

I’m a rabbit with a release to greet,
I hop through tags on nimble feet.
Clean merges bloom; conflicts wait,
While branch rules check the gate.
New ignore lines keep env files out,
I nibble carrots, then I’m off to scout.

Comment @coderabbitai help to get the list of available commands.

@project516-review-bot project516-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The PR rewrites the upstream sync workflow to track the latest stable Seerr release instead of develop, opens a PR on upstream-sync/<tag> with conflict markers committed when the merge conflicts, skips releases already merged or with an open PR, and arms auto-merge (merge commit) on clean merges when branch protection exists. It also fixes .gitignore by removing v3.4.1 conflict markers and adding fork-specific ignores. Two defects in the new code: the auto-merge arming script checks for required_status_checks in ruleset types instead of rule types, so it will never arm even with proper rulesets; and the workflow has a duplicate cron line.


review-bot, model nvidia/nemotron-3-ultra-550b-a55b:free, verdict approve

method="$2"

base="$(gh pr view "$pr" --json baseRefName --jq .baseRefName)"
types="$(gh api "repos/${GH_REPO}/rules/branches/${base}" --jq '[.[].type]')"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Rulesets API returns each ruleset's type (e.g., pull_request), not the rule types inside it. required_status_checks is a rule type, not a ruleset type, so this check will never pass. You need to inspect .rules[].type within each ruleset, e.g., gh api ... --jq '[.[] | .rules[].type] | unique'.

git add -A
git commit --no-edit
fi
git push --force origin "$branch"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Force-pushing the sync branch will overwrite any manual conflict resolution if the workflow re-runs after a PR was closed without merging. The existing-open-PR check (line 73) prevents this while the PR is open, but not after it is closed. Consider skipping the force-push when the branch already exists on the remote and the PR is closed, or accept this as expected behaviour.

@project516-review-bot project516-review-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The PR rewrites upstream-sync.yml to track stable releases instead of develop, open PRs with conflict markers committed, and arm auto-merge on clean merges. It adds arm-automerge.sh to gate auto-merge behind branch rulesets, and fixes .gitignore by removing conflict markers. Three defects: arm-automerge.sh checks ruleset types instead of rule types so required_status_checks will never pass; force-pushing the sync branch overwrites manual conflict resolution after a PR is closed; .gitignore omits config/ and committag.json despite the description claiming they are included.

Not approved: the check on these comments could not run, so they are unverified.


review-bot, model nvidia/nemotron-3-ultra-550b-a55b:free, verdict comment

Comment thread .github/scripts/arm-automerge.sh Resolved
Comment thread .github/workflows/upstream-sync.yml Resolved
Comment thread .gitignore Resolved
Comment thread .github/workflows/upstream-sync.yml Resolved
@coderabbitai coderabbitai Bot added the slop label Oct 8, 2026
@Project516
Project516 merged commit 62e8404 into master Oct 8, 2026
14 checks passed
@Project516
Project516 deleted the ci/upstream-sync-release branch October 8, 2026 21:57
@Project516 Project516 mentioned this pull request Nov 12, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant