Skip to content

chore: add repository synchronization gates - #4859

Draft
carderne wants to merge 2 commits into
mainfrom
chore/prepare-repo-ops-sync
Draft

chore: add repository synchronization gates#4859
carderne wants to merge 2 commits into
mainfrom
chore/prepare-repo-ops-sync

Conversation

@carderne

@carderne carderne commented Sep 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds disabled repository synchronization workflows and guards merge-queue entries against unsynchronized changes. The workflows remain inactive until the repository configuration is explicitly enabled.

@changeset-bot

changeset-bot Bot commented Sep 1, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 12cfdc6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Comment thread .github/workflows/dispatch-repo-ops-sync.yml Fixed
Comment thread .github/workflows/repo-ops-sync-gate.yml Fixed
@coderabbitai

coderabbitai Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Adds one workflow that dispatches public repository SHA updates to a private monorepo. Adds another workflow that blocks reserved RepoOps trailers in pull requests and polls repository synchronization during merge groups.

Merge Risk: 🟡 Moderate · up to 12cfd

The PR adds repository synchronization dispatch and merge-queue gating, but the current behavior can run the gate before synchronization is configured, broaden credential scope when repository configuration is empty, and delay merge processing if an operation hangs. These bounded availability and security risks require fixes or explicit owner acceptance before merge.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description accurately summarizes the change, but it omits most required template sections, including the issue reference, checklist, testing steps, changelog, and screenshots. Complete the required template sections. Add a valid issue reference, checklist responses, testing steps, a short changelog entry, and screenshots or an explicit indication that screenshots are not applicable.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: adding repository synchronization gates. It is concise and specific.
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 0…
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.
Full details: Docstring Coverage

Explanation

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 0 files. (2 skipped: 2 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/prepare-repo-ops-sync

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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 7a152ca9-b68e-40ed-a595-a774409c29f0

📥 Commits

Reviewing files that changed from the base of the PR and between 43ecf15 and 4a6ba4a.

📒 Files selected for processing (2)
  • .github/workflows/dispatch-repo-ops-sync.yml
  • .github/workflows/repo-ops-sync-gate.yml

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: code-quality / code-quality
  • GitHub Check: Analyze (javascript-typescript)
⚠️ CI failures not shown inline (1)

GitHub Check: zizmor: 2 new alerts including 2 errors

Conclusion: failure

View job details

### New alerts in code changed by this pull request
 * 2 errors
See annotations below for details.
[View all branch alerts](/triggerdotdev/trigger.dev/security/code-scanning?query=pr%3A4859+tool%3Azizmor+is%3Aopen).
🧰 Additional context used
🪛 GitHub Check: zizmor
.github/workflows/dispatch-repo-ops-sync.yml

[failure] 26-26:
dangerous use of GitHub App tokens: token granted access to all repositories for this owner's app installation

.github/workflows/repo-ops-sync-gate.yml

[failure] 44-44:
dangerous use of GitHub App tokens: token granted access to all repositories for this owner's app installation

🔇 Additional comments (2)
.github/workflows/dispatch-repo-ops-sync.yml (2)

26-27: Restrict the App token to the target repository.

This repeats the existing review finding. With owner: triggerdotdev and no repositories input, actions/create-github-app-token@v3.2.0 scopes the token to every repository in that owner's installation. permission-contents: write makes that scope writable. (github.com)

Add a single-repository repositories allowlist before enabling the workflow. Then verify that the generated token is limited to MONO_REPOSITORY.

Proposed scope fix
           owner: triggerdotdev
+          repositories: ${{ secrets.REPO_OPS_MONO_REPOSITORY }}
           permission-contents: write

Sources: MCP tools, Linters/SAST tools


1-25: LGTM!

Also applies to: 29-41

contents: read

jobs:
gate:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Add an explicit RepoOps activation guard.

The job runs for every pull request and merge group. It does not wait for repository configuration. On a merge-group event without the App variables and secret, Create read-only Dispatcher App token fails and blocks the queue. Add a job-level condition that requires an explicit enable variable.

Proposed fix
 jobs:
   gate:
+    if: vars.REPO_OPS_SYNC_ENABLED == 'true'
     runs-on: ubuntu-latest
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
gate:
gate:
if: vars.REPO_OPS_SYNC_ENABLED == 'true'

git clone --filter=blob:none --no-tags \
"https://x-access-token:${APP_TOKEN}@github.com/${MONO_REPOSITORY}.git" mono

for _ in $(seq 1 60); do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Bound each polling operation.

The loop limit only applies after git fetch and plan-repo-ops-outbound.sh return. If either command hangs, the merge-group gate does not reach Line 84 and remains running until the workflow job limit. Add a job timeout and command-level deadlines.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 2ceba81b-df58-4b76-95a8-6104df065319

📥 Commits

Reviewing files that changed from the base of the PR and between 4a6ba4a and 12cfdc6.

📒 Files selected for processing (2)
  • .github/workflows/dispatch-repo-ops-sync.yml
  • .github/workflows/repo-ops-sync-gate.yml

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.

📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: code-quality / code-quality
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
.github/workflows/repo-ops-sync-gate.yml (2)

11-11: Keep the gate inactive until synchronization is enabled.

The gate job has no job-level if. It runs on pull request and merge group events when REPO_OPS_SYNC_ENABLED is not 'true'. Add the same activation guard used by dispatch.


66-74: Bound each merge-group operation.

The 60-iteration limit applies only after git fetch and plan-repo-ops-outbound.sh return. A hung network call or script can keep the merge-group job running beyond the intended polling window. Add a job timeout and command-level deadlines.

app-id: ${{ vars.REPO_OPS_DISPATCHER_APP_ID }}
private-key: ${{ secrets.REPO_OPS_DISPATCHER_APP_PRIVATE_KEY }}
owner: triggerdotdev
repositories: ${{ secrets.REPO_OPS_MONO_REPOSITORY }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

printf '%s\n' '--- applicable repository conventions ---'
find /tmp/coderabbit-repo-knowledge/triggerdotdev-trigger-dev-0bdd0019 -maxdepth 2 -type f -name '*.md' -print
printf '%s\n' '--- workflow excerpts ---'
for f in .github/workflows/dispatch-repo-ops-sync.yml .github/workflows/repo-ops-sync-gate.yml; do
  echo "### $f"
  cat -n "$f" | sed -n '1,90p'
done

Repository: triggerdotdev/trigger.dev

Length of output: 12230


🌐 Web query:

actions/create-github-app-token v3.2.0 README owner repositories empty input all repositories

💡 Result:

In the actions/create-github-app-token v3.2.0 action, the behavior when the repositories input is empty depends on the state of the owner input [1][2]: 1. If owner is provided (explicitly set) and repositories is empty, the resulting token is scoped to all repositories within the GitHub App installation of that owner [1][3]. 2. If both owner and repositories are empty (unset), the token is scoped only to the current repository where the workflow is running [1][2]. The documentation explicitly notes this distinction: "If owner is set and repositories is empty, access will be scoped to all repositories in the provided repository owner's installation. If owner and repositories are empty, access will be scoped to only the current repository" [1][4]. Note that some users have found the documentation's phrasing regarding what constitutes a "set" owner to be slightly ambiguous, but the functional behavior is as described above [5].

Citations:


Security Misconfiguration (CWE-250)

Reachability: Internal · Exploitability: Difficult

Validate REPO_OPS_MONO_REPOSITORY before creating either App token.

When the secret is empty, owner: triggerdotdev with an empty repositories input scopes the token to all repositories in that installation. Validate the secret before token creation in both workflows.

  • .github/workflows/dispatch-repo-ops-sync.yml#L27-L27: write-capable token.
  • .github/workflows/repo-ops-sync-gate.yml#L45-L45: read-only token.
📍 Affects 2 files
  • .github/workflows/dispatch-repo-ops-sync.yml#L27-L27 (this comment)
  • .github/workflows/repo-ops-sync-gate.yml#L45-L45

Source: MCP tools

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.

2 participants