Skip to content

feat(ci): mship companion pr check - #5079

Merged
Sg312 merged 4 commits into
stagingfrom
dev
Jun 16, 2026
Merged

Sg312 merged 4 commits into
stagingfrom
dev

Conversation

@Sg312

@Sg312 Sg312 commented Jun 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Adds companion ci check to check for drift with mothership service
Companion: https://github.com/simstudioai/copilot/pull/309

Type of Change

  • New feature

Testing

Manual

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Sg312 added 2 commits June 15, 2026 17:08
Mirror of copilot's repo-agnostic companion-pr-check workflow: a soft,
non-blocking warning on PRs to staging/main when a declared cross-repo Companion
PR isn't merged in lockstep. Declare via a "Companion:" trailer or a
"## Companion PRs" task list. Requires the CROSS_REPO_TOKEN secret.
…d releases

Mirror of copilot: on staging->main release PRs, aggregate Companion
declarations from every squashed feature PR in the release (deduped).
dev->staging stays single-PR.
@vercel

vercel Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Jun 16, 2026 12:44am

Request Review

@greptile-apps

greptile-apps Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces a new GitHub Actions workflow that detects cross-repo "Companion:" PR declarations in PR descriptions and posts a sticky comment indicating whether those companion PRs have been merged, keeping the simstudioai/sim and a paired repo in lockstep.

  • New workflow (companion-pr-check.yml): triggers on pull_request events for staging/main and on a */30 * * * * schedule; parses "Companion:" trailers and task-list refs from PR bodies, fetches companion PR state via a CROSS_REPO_TOKEN secret, and upserts a sticky comment with ✅/⚠️/❌ status per companion.
  • Release-PR aggregation: for PRs targeting main, it also walks squash-merge commit messages to collect companion declarations from the feature PRs bundled into the release.
  • Label management: applies a has-companion label when companions are found, but never removes it — leaving a stale label when companions are later deleted from the description or when the scheduled run re-evaluates a PR that no longer has companions.

Confidence Score: 3/5

The workflow is safe to merge as a non-blocking informational check, but two logic gaps mean it will not behave as documented in common situations.

The has-companion label is applied but never removed, so PRs whose descriptions are later edited to drop companion declarations will carry a stale label forever. Separately, the scheduled refresh cron will silently do nothing until this workflow file also exists on the default branch — meaning the primary motivation for the schedule (catching companions that merge after this PR opens) won't work in the interim period.

companion-pr-check.yml — the label-removal path and the scheduled-run default-branch dependency both need attention before the workflow behaves as its comments describe.

Important Files Changed

Filename Overview
.github/workflows/companion-pr-check.yml New CI workflow that posts a sticky comment and applies a has-companion label when a PR declares cross-repo companion PRs. Label is never removed when companions are cleared from the description, and the scheduled refresh is a no-op until the file lands on the default branch.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([Trigger]) --> B{Event type?}
    B -->|pull_request| C[checkPR: context.payload.pull_request]
    B -->|schedule / workflow_dispatch| D[List open PRs on staging + main]
    D --> E[checkPR: each PR]
    C --> F[collectCompanions]
    E --> F
    F --> G{PR targets main?}
    G -->|yes| H[Fetch commits → extract squash-merge PR numbers → parse each feature PR body]
    G -->|no| I[Parse PR body only]
    H --> J[Deduplicated companion list]
    I --> J
    J --> K{Any companions?}
    K -->|no| L[Delete sticky comment — label NOT removed]
    K -->|yes| M[ensureLabel + addLabels: has-companion]
    M --> N{CROSS_REPO_TOKEN set?}
    N -->|no| O[❓ could not verify]
    N -->|yes| P[cross.rest.pulls.get for each companion]
    P --> Q{cp.merged?}
    Q -->|yes + correct base| R[✅ line]
    Q -->|yes + wrong base| S[⚠️ line, warn=true]
    Q -->|no| T[❌ line, warn=true]
    P -->|error| U[❓ line, warn=true]
    R & S & T & U & O --> V[upsert sticky comment]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A([Trigger]) --> B{Event type?}
    B -->|pull_request| C[checkPR: context.payload.pull_request]
    B -->|schedule / workflow_dispatch| D[List open PRs on staging + main]
    D --> E[checkPR: each PR]
    C --> F[collectCompanions]
    E --> F
    F --> G{PR targets main?}
    G -->|yes| H[Fetch commits → extract squash-merge PR numbers → parse each feature PR body]
    G -->|no| I[Parse PR body only]
    H --> J[Deduplicated companion list]
    I --> J
    J --> K{Any companions?}
    K -->|no| L[Delete sticky comment — label NOT removed]
    K -->|yes| M[ensureLabel + addLabels: has-companion]
    M --> N{CROSS_REPO_TOKEN set?}
    N -->|no| O[❓ could not verify]
    N -->|yes| P[cross.rest.pulls.get for each companion]
    P --> Q{cp.merged?}
    Q -->|yes + correct base| R[✅ line]
    Q -->|yes + wrong base| S[⚠️ line, warn=true]
    Q -->|no| T[❌ line, warn=true]
    P -->|error| U[❓ line, warn=true]
    R & S & T & U & O --> V[upsert sticky comment]
Loading

Reviews (1): Last reviewed commit: "ci(companion): aggregate companions acro..." | Re-trigger Greptile

Comment thread .github/workflows/companion-pr-check.yml
Comment thread .github/workflows/companion-pr-check.yml
Comment thread .github/workflows/companion-pr-check.yml
Sg312 added 2 commits June 15, 2026 17:38
…uire @actions/github)

Mirror of copilot: companion-pr-check failed with MODULE_NOT_FOUND. Read the other
repo's PR with a plain REST fetch + the PAT in the header (PAT stays read-only;
commenting/labeling uses GITHUB_TOKEN).
…veat

Mirror of copilot: clear() removes the has-companion label when a PR's companions
are all removed; schedule default-branch caveat documented; github-script kept at
@v7 to match repo convention.
@github-actions github-actions Bot added the has-companion Has a cross-repo companion PR (see companion-pr-check) label Jun 16, 2026
@github-actions

github-actions Bot commented Jun 16, 2026 •

Copy link
Copy Markdown

⚠️ Cross-repo companion check

One or more companion PRs aren't merged into staging yet. Merging this without them will leave copilot and sim out of sync — merge them in lockstep.

  • ❌ simstudioai/copilot#309 — OPEN, not merged (targets staging) — ci(companion): cross-repo companion-PR warning + mship-release

@Sg312
Sg312 merged commit cbd3d22 into staging Jun 16, 2026
30 checks passed

This branch was successfully deployed

1 active deployment
Preview — 28526dd5 Deployed Jun 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

has-companion Has a cross-repo companion PR (see companion-pr-check)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant