Skip to content

Document fork PR uploads via public repo identifier#596

Draft
mmatheson wants to merge 3 commits intomainfrom
matt/fix-docs
Draft

Document fork PR uploads via public repo identifier#596
mmatheson wants to merge 3 commits intomainfrom
matt/fix-docs

Conversation

@mmatheson
Copy link
Copy Markdown
Member

Summary

  • Adds flaky-tests/forked-pull-requests.md covering how to upload test results and check the quarantine list from PRs opened from forked repos, where GitHub workflow runs cannot read repository secrets.
  • Walks through enabling the per-repo toggle in Settings → Repositories → Flaky Tests → Forked PR uploads, copying the public repo identifier, and adding public-repo-id to the trunk-io/analytics-uploader step alongside the existing token.
  • Documents the authorization model (toggle on = accept, toggle off = 401), the limited scope (uploads + quarantine list only — Merge Queue still requires a token), and a short troubleshooting table.
  • Wires the new page into summary.md between Quarantine Service Availability and Pull request comments.

Test plan

  • Confirm the page renders correctly in the docs preview and the entry appears in the Flaky Tests sidebar in the expected position.
  • Verify cross-links to uploader.md and quarantining.md resolve.
  • Confirm the action input name (public-repo-id) and CLI flag (--public-repo-id) match the shipped names in trunk-io/analytics-uploader and trunk-analytics-cli.
  • Confirm the settings UI labels (Forked PR uploads, Enable forked PR uploads) match production.

🤖 Generated with Claude Code

Adds a Flaky Tests page explaining how to upload test results and
fetch the quarantine list from pull requests opened from forks, where
GitHub does not expose repository secrets to workflow runs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@trunk-staging-io
Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 5, 2026

Claude finished @mmatheson's task in 2m 21s —— View job


Review complete

  • Gather context
  • Read changed files
  • Review for typos, grammar, formatting, and documentation best practices
  • Post review feedback

Summary

The new flaky-tests/forked-pull-requests.md page is well-structured and clearly explains the forked PR upload workflow. The content is accurate, the authorization model section is thorough, and the troubleshooting table is a nice addition. The summary.md placement between Quarantine Service Availability and Pull request comments is logical.

Three non-blocking suggestions posted as inline comments:

  1. Line 11 — Minor phrasing nit: "the same as PRs" → "just like PRs" reads more naturally.
  2. Line 30 — Navigation path uses arrows and _**your repo**_ (italic+bold), which differs from the > separator and plain text placeholder used elsewhere in the docs (e.g., quarantining.md).
  3. Line 55 — The CLI usage is mentioned but lacks an example code block, unlike the action YAML example above it. Adding one would make the section complete.

No blocking issues. The page is ready to merge once the test plan items are verified (especially confirming public-repo-id and --public-repo-id match the shipped names in trunk-io/analytics-uploader and trunk-analytics-cli).


Repositories that accept pull requests from forks — most commonly open-source projects on GitHub — face a CI limitation: **workflow runs triggered from a fork do not have access to the upstream repository's secrets.** In those runs, `secrets.TRUNK_API_TOKEN` is empty, the [Trunk Analytics CLI](uploader.md) cannot authenticate, and the upload fails.

To support these workflows, Trunk provides a **public repo identifier** that you embed directly in your workflow YAML. The Trunk backend uses it to route requests to your repository without an API token. This lets fork PRs upload test results and check the quarantine list, the same as PRs opened from a branch on the upstream repo.
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.

Minor phrasing nit: "the same as PRs opened from a branch on the upstream repo" is slightly awkward as a trailing clause.

Suggested change
To support these workflows, Trunk provides a **public repo identifier** that you embed directly in your workflow YAML. The Trunk backend uses it to route requests to your repository without an API token. This lets fork PRs upload test results and check the quarantine list, the same as PRs opened from a branch on the upstream repo.
To support these workflows, Trunk provides a **public repo identifier** that you embed directly in your workflow YAML. The Trunk backend uses it to route requests to your repository without an API token. This lets fork PRs upload test results and check the quarantine list, just like PRs opened from a branch on the upstream repo.


### Enable the identifier

1. In the Trunk app, go to **Settings → Repositories →** _**your repo**_ **→ Flaky Tests**.
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.

The navigation path formatting is inconsistent with the rest of the docs. For example, quarantining.md uses > as the separator and plain text for placeholder values:

**Settings** > **Repositories** > repository > **Flaky Tests**

This page uses arrows and _**your repo**_ (italic + bold). Consider aligning with the existing convention:

Suggested change
1. In the Trunk app, go to **Settings → Repositories →** _**your repo**_ **Flaky Tests**.
1. In the Trunk app, go to **Settings** > **Repositories** > your repo > **Flaky Tests**.


To verify the fallback is working, open a pull request from a fork. The upload step should complete successfully, and the run should appear on the **Flaky Tests** dashboard for the upstream repository within a few minutes.

If you call the [Trunk Analytics CLI](uploader.md) directly instead of through the action, pass `--public-repo-id` alongside `--token`. The CLI applies the same fallback rule.
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.

This mentions the CLI flag but doesn't show a concrete example, whereas the action usage above has a full YAML snippet. Adding an example would make this section more useful:

Suggested change
If you call the [Trunk Analytics CLI](uploader.md) directly instead of through the action, pass `--public-repo-id` alongside `--token`. The CLI applies the same fallback rule.
If you call the [Trunk Analytics CLI](uploader.md) directly instead of through the action, pass `--public-repo-id` alongside `--token`. The CLI applies the same fallback rule.
```bash
trunk-analytics-cli upload \
--junit-paths "./target/junit-*.xml" \
--org-url-slug <TRUNK_ORG_SLUG> \
--token "$TRUNK_API_TOKEN" \
--public-repo-id abcd1234


Repositories that accept pull requests from forks — most commonly open-source projects on GitHub — face a CI limitation: **workflow runs triggered from a fork do not have access to the upstream repository's secrets.** In those runs, `secrets.TRUNK_API_TOKEN` is empty, the [Trunk Analytics CLI](uploader.md) cannot authenticate, and the upload fails.

To support these workflows, Trunk provides a **public repo identifier** that you embed directly in your workflow YAML. The Trunk backend uses it to route requests to your repository without an API token. This lets fork PRs upload test results and check the quarantine list, the same as PRs opened from a branch on the upstream repo.
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.

Minor phrasing nit: "the same as PRs opened from a branch on the upstream repo" is slightly awkward as a trailing clause.

Suggested change
To support these workflows, Trunk provides a **public repo identifier** that you embed directly in your workflow YAML. The Trunk backend uses it to route requests to your repository without an API token. This lets fork PRs upload test results and check the quarantine list, the same as PRs opened from a branch on the upstream repo.
To support these workflows, Trunk provides a **public repo identifier** that you embed directly in your workflow YAML. The Trunk backend uses it to route requests to your repository without an API token. This lets fork PRs upload test results and check the quarantine list, just like PRs opened from a branch on the upstream repo.


### Enable the identifier

1. In the Trunk app, go to **Settings → Repositories →** _**your repo**_ **→ Flaky Tests**.
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.

The navigation path formatting is inconsistent with the rest of the docs. For example, quarantining.md uses > as the separator and plain text for placeholder values:

**Settings** > **Repositories** > repository > **Flaky Tests**

This page uses arrows and _**your repo**_ (italic + bold). Consider aligning with the existing convention:

Suggested change
1. In the Trunk app, go to **Settings → Repositories →** _**your repo**_ **Flaky Tests**.
1. In the Trunk app, go to **Settings** > **Repositories** > your repo > **Flaky Tests**.


To verify the fallback is working, open a pull request from a fork. The upload step should complete successfully, and the run should appear on the **Flaky Tests** dashboard for the upstream repository within a few minutes.

If you call the [Trunk Analytics CLI](uploader.md) directly instead of through the action, pass `--public-repo-id` alongside `--token`. The CLI applies the same fallback rule.
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.

This mentions the CLI flag but doesn't show a concrete example, whereas the action usage above has a full YAML snippet. Adding an example would make this section more useful:

Suggested change
If you call the [Trunk Analytics CLI](uploader.md) directly instead of through the action, pass `--public-repo-id` alongside `--token`. The CLI applies the same fallback rule.
If you call the [Trunk Analytics CLI](uploader.md) directly instead of through the action, pass `--public-repo-id` alongside `--token`. The CLI applies the same fallback rule.
```bash
trunk-analytics-cli upload \
--junit-paths "./target/junit-*.xml" \
--org-url-slug <TRUNK_ORG_SLUG> \
--token "$TRUNK_API_TOKEN" \
--public-repo-id abcd1234

The CLI fetches the quarantine list via /v1/metrics/getQuarantineConfig
on fork-PR runs, not /v1/flaky-tests/list-quarantined-tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Auto-approved: Claude code review passed.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 5, 2026

Claude finished @mmatheson's task in 1m 11s —— View job


Review complete

  • Gather context
  • Read changed files
  • Review for typos, grammar, formatting, and documentation best practices
  • Post review feedback

Summary

This re-review was triggered by the follow-up commit (676d523) that corrected the endpoint reference from a generic description to the specific /v1/metrics/getQuarantineConfig path — a good, accurate improvement.

The flaky-tests/forked-pull-requests.md page is well-structured and clearly explains the forked PR upload workflow. No new issues were introduced by the latest commit.

Three previously-noted non-blocking suggestions remain open:

  1. Line 11 — "the same as PRs opened from a branch on the upstream repo" is slightly awkward as a trailing clause. "just like PRs from a branch on the upstream repo" reads more naturally.

  2. Line 30 — Navigation path uses arrows and _**your repo**_ (italic+bold), which differs from the > separator and plain text placeholder used elsewhere (e.g., quarantining.md line 46: **Settings** > **Repositories** > repository > **Flaky Tests**). Fix this →

  3. Line 55 — The CLI flag --public-repo-id is mentioned without a concrete code example, unlike the action YAML snippet above it. Adding a bash block with a trunk-analytics-cli upload invocation would make this section consistent.

No blocking issues. The page is ready to merge once the test plan items are verified (especially confirming public-repo-id and --public-repo-id match the shipped names in trunk-io/analytics-uploader and trunk-analytics-cli).

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Auto-approved: Claude code review passed.

@claude
Copy link
Copy Markdown
Contributor

claude Bot commented May 6, 2026

Claude finished @samgutentag's task in 1m 37s —— View job


Review complete

  • Read changed files
  • Review for typos, grammar, formatting, and documentation best practices
  • Post review feedback

Summary

This synchronize event was triggered by the merge of main into matt/fix-docs (commit b10aab4). The PR files themselves (flaky-tests/forked-pull-requests.md, summary.md) have not changed since the previous review on commit 676d523 — file SHA is still 454bb44.

No new issues were introduced. The three previously-noted non-blocking suggestions remain open:

  1. Line 11 — "the same as PRs opened from a branch on the upstream repo" reads awkwardly as a trailing clause. "just like PRs from a branch on the upstream repo" is more natural. Same phrasing reappears on line 63 ("the same as a token-authenticated request") and could be revised to match.

  2. Line 30 — Navigation path uses separators and _**your repo**_ (italic+bold), inconsistent with the > separator and plain text placeholder used elsewhere. Compare:

    • forked-pull-requests.md:30: **Settings → Repositories →** _**your repo**_ **→ Flaky Tests**
    • quarantining.md:46: **Settings** > **Repositories** > repository > **Flaky Tests**
    • quarantining.md:239: **Settings** > **Repositories** **>** repository **>** **Flaky Tests** > **Audit logs**

    Fix this →

  3. Line 55 — CLI flag --public-repo-id is mentioned without a concrete example, unlike the action YAML snippet above. A bash block with a trunk-analytics-cli upload invocation would round out this section.

    Fix this →

No blocking issues. The page is ready to merge once the test plan items are verified — particularly that the action input (public-repo-id) and CLI flag (--public-repo-id) match the shipped names in trunk-io/analytics-uploader and trunk-analytics-cli.
Branch: matt/fix-docs

Copy link
Copy Markdown

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

Auto-approved: Claude code review passed.

@samgutentag
Copy link
Copy Markdown
Member

Verification status (2026-05-06): blocked

Eng PR not merged. Hold.

  • Eng PR: trunk-io/trunk2#3908 "feat(flaky-tests): per-repo opt-in for fork PR uploads" — currently OPEN, not draft. Inferred from docs content; the docs PR body has no eng PR reference.
  • Flag: n/a (eng PR not merged)
  • Signals:
    • trunk2#3908 is OPEN; cross-repo work in legacy monolith and analytics-cli also flagged as out of scope/TODO in the eng PR body
    • Settings UI ("Forked PR uploads" toggle) and public-repo-id action input depend on this PR landing first

Branch state: up to date with main.

Suggested next action: hold until trunk2#3908 (and related analytics-cli/monolith work) merges. Re-run after merge.

@samgutentag samgutentag marked this pull request as draft May 6, 2026 22:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants