Skip to content

ci: follow upstream automatically and gate what gets synced - #2

Merged
YasunoriMATSUOKA merged 1 commit into
nemtusfrom
ci/mirror-sync
Nov 19, 2026
Merged

YasunoriMATSUOKA merged 1 commit into
nemtusfrom
ci/mirror-sync

Conversation

@YasunoriMATSUOKA

Copy link
Copy Markdown
Member

Adds a daily mirror-sync.yml so upstream changes and pending releases are noticed without watching upstream by hand, with guards against syncing a malicious upstream change.

What it does

Sync (daily, or manual dispatch)

  1. Reviews new upstream commits with .github/scripts/review-upstream-diff.sh: routine (version lines only), needs review (anything else, with a list of what to look at), or blocked (touches .github/; the run fails and nothing is pushed).
  2. Fast-forwards the master mirror.
  3. Waits out a 3-day cooldown since upstream's branch last moved (from GitHub's activity log, not commit dates). Manual dispatch with skip_cooldown opens the pull request immediately.
  4. Opens a sync/upstream-<sha> pull request into nemtus with the review report, and starts the build check on it.

Release watch: reports when upstream's latest release is not contained in the latest nemtus-v* release, with the tag to push. It never tags or publishes.

Notify: Discord through the repository secret DISCORD_WEBHOOK_URL (skipped when unset).

Publish guard: nemtus-image.yml now refuses to publish a commit that is not on nemtus.

The sync job has a write token and never executes upstream code: it runs git and the review script from the nemtus checkout only.

Test

Run locally against a sandbox (bare origin/upstream clones, stubbed gh):

  • sync: up to date; cooldown (message once, silent on later runs); cooldown elapsed (merge commit by the bot, pull request, build dispatch); rerun with the pull request open; skip_cooldown; blocked on .github/ (mirror not advanced); merge conflict; rewritten upstream history
  • release watch: today's state (reports nemtus-v1.25.7-2 pending), stale release, up to date, new upstream release not yet synced, malformed tag
  • review script: real history (0e72267..8f8f9ff routine, 8f8f9ff..38c350d needs review) and synthetic diffs (swapped download host, pipe to shell, changed base image registry, payload in a startup script, binary, opaque blob, added workflow)

Not exercised on GitHub yet: schedule and workflow_dispatch only run from the default branch, so the first real run happens after this is merged.

After merging

  • Add the repository secret DISCORD_WEBHOOK_URL.
  • Run the workflow once by hand to confirm it.

🤖 Generated with Claude Code

Add mirror-sync.yml, a daily workflow that:

- reviews new upstream commits with review-upstream-diff.sh and refuses to
  sync a diff that touches .github/ (it would run with this repository's
  privileges once merged)
- fast-forwards the master mirror
- waits out a 3-day cooldown, skippable by manual dispatch for urgent
  security fixes
- opens a sync pull request into nemtus, titled [routine] or
  [needs review], with the review report in its body
- reports when upstream's latest release is not contained in the latest
  nemtus-v* release
- notifies Discord through the DISCORD_WEBHOOK_URL repository secret

Releasing stays manual. nemtus-image.yml now refuses to publish a commit
that is not on the nemtus branch.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 19, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 5644e1e7-a2b8-4b6b-9f6d-19402659699f
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@YasunoriMATSUOKA
YasunoriMATSUOKA merged commit 9bbd815 into nemtus Nov 19, 2026
4 checks passed
@YasunoriMATSUOKA
YasunoriMATSUOKA deleted the ci/mirror-sync branch November 19, 2026 14:24
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.

1 participant