Skip to content

improvement(ci): rename companion tags to be more descriptive#5081

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

improvement(ci): rename companion tags to be more descriptive#5081
Sg312 merged 7 commits into
stagingfrom
dev

Conversation

@Sg312

@Sg312 Sg312 commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Rename companion tags to be more descriptive
Companion: https://github.com/simstudioai/copilot/pull/311

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 4 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.
…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.
@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 1:47am

Request Review

@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#311OPEN, not merged (targets staging) — improvement(ci): directional labels + companion-check refinements

@greptile-apps

greptile-apps Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces a new GitHub Actions workflow (companion-pr-check) that surfaces whether cross-repo "companion" PRs have been merged before a PR targeting staging or main is merged, keeping the copilot and sim repos in lockstep.

  • Companion detection: parses Companion: trailers and task-list refs from PR descriptions using two regex patterns; for main-targeting PRs it also aggregates companions from squash-merged feature PRs found in commit messages.
  • Sticky comment + label: posts or updates a single bot comment with merge status (✅/⚠️/❌) and applies a has-companion label; both are cleaned up when companions are removed.
  • Scheduled refresh: a 30-minute cron re-checks all open PRs in case a companion merges after this PR opens (with the documented caveat that the schedule only activates once the file reaches the default branch).

Confidence Score: 4/5

Safe to merge — the workflow is additive, non-blocking, and has no effect on application code or deployments.

The workflow logic is well-constructed: global regex lastIndex is properly reset before each use, graceful degradation works when the secret is absent, and label/comment cleanup is handled. The two concerns are the 30-minute cron unconditionally scanning every open PR (which grows expensive as PR count rises) and the fully silent error swallowing in label operations that would hide permission or API failures.

.github/workflows/companion-pr-check.yml — specifically the scheduled cron logic and the label-management error handling.

Important Files Changed

Filename Overview
.github/workflows/companion-pr-check.yml New GitHub Actions workflow that adds a soft companion-PR check: parses Companion: trailers or task-list refs from PR descriptions, fetches cross-repo PR state via a PAT, and posts/updates a sticky comment. Logic is sound with proper global-regex resets and graceful degradation when the secret is absent; the main concern is the 30-minute cron scanning all open PRs unconditionally.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A([Trigger: pull_request / schedule / workflow_dispatch]) --> B{Event type?}
    B -- pull_request --> C[checkPR for this PR]
    B -- schedule/dispatch --> D[List all open PRs for staging + main]
    D --> C
    C --> E[collectCompanions]
    E --> F{PR targets main?}
    F -- Yes --> G[paginate commits, extract squash PR refs]
    G --> H[fetch body of each feature PR]
    H --> I[merge companion refs into set]
    F -- No --> J[parseCompanions from PR body only]
    I --> K{companions.length === 0?}
    J --> K
    K -- Yes --> L[clear: delete sticky comment + remove label]
    K -- No --> M[ensureLabel 'has-companion']
    M --> N[addLabels]
    N --> O{crossToken set?}
    O -- No --> P[line: set CROSS_REPO_TOKEN]
    O -- Yes --> Q[crossGetPR via fetch + PAT]
    Q --> R{PR merged?}
    R -- Yes, correct tier --> S[line: merged ok]
    R -- Yes, wrong tier --> T[line: tier mismatch]
    R -- No --> U[line: not merged]
    Q -- error --> V[line: could not read]
    P & S & T & U & V --> W[upsert sticky comment with heading]
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: pull_request / schedule / workflow_dispatch]) --> B{Event type?}
    B -- pull_request --> C[checkPR for this PR]
    B -- schedule/dispatch --> D[List all open PRs for staging + main]
    D --> C
    C --> E[collectCompanions]
    E --> F{PR targets main?}
    F -- Yes --> G[paginate commits, extract squash PR refs]
    G --> H[fetch body of each feature PR]
    H --> I[merge companion refs into set]
    F -- No --> J[parseCompanions from PR body only]
    I --> K{companions.length === 0?}
    J --> K
    K -- Yes --> L[clear: delete sticky comment + remove label]
    K -- No --> M[ensureLabel 'has-companion']
    M --> N[addLabels]
    N --> O{crossToken set?}
    O -- No --> P[line: set CROSS_REPO_TOKEN]
    O -- Yes --> Q[crossGetPR via fetch + PAT]
    Q --> R{PR merged?}
    R -- Yes, correct tier --> S[line: merged ok]
    R -- Yes, wrong tier --> T[line: tier mismatch]
    R -- No --> U[line: not merged]
    Q -- error --> V[line: could not read]
    P & S & T & U & V --> W[upsert sticky comment with heading]
Loading

Reviews (1): Last reviewed commit: "improvement(ci): rename companion tags t..." | Re-trigger Greptile

Comment thread .github/workflows/companion-pr-check.yml Outdated
Comment thread .github/workflows/companion-pr-check.yml Outdated
Resolve the add/add conflict in companion-pr-check.yml by keeping dev's
directional-label version (requires-mothership-merge / requires-sim-merge),
a strict superset of staging's has-companion version. Brings dev up to date
with staging's other changes.
@github-actions github-actions Bot added the requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep label Jun 16, 2026
@Sg312 Sg312 removed the has-companion Has a cross-repo companion PR (see companion-pr-check) label Jun 16, 2026
Mirror of copilot: remove the */30 scheduled bulk scan (greptile P2) that
re-listed comments for every open staging/main PR toward the GITHUB_TOKEN rate
limit. PR-driven only (companions are tagged on both sides); workflow_dispatch
stays for manual full re-scans. Also surface non-404/422 label-API failures via
core.warning so silent errors are observable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

requires-mothership-merge Has a companion PR on the mothership/copilot side — merge in lockstep

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant