[Bug]: "Approve workflows to run" never shows for same-repository PRs with runs awaiting approval
Before submitting
- [x] I searched existing issues and did not find a duplicate.
- [x] I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- In a GitHub repository where workflow runs on bot-authored PRs need maintainer approval, open a PR from a branch in the same repository (not a fork). The PR in my case was opened by
github-actions[bot]. - Let the PR's
pull_requestworkflow runs end instatus: completed,conclusion: action_required. GitHub's web UI then shows "Approve workflows to run". - As a user with write (push) access, open the PR in T3 Code desktop.
Expected behavior
The PR detail panel shows "Approve workflows to run", matching GitHub's web UI, so the runs can be approved from T3.
Actual behavior
The button never shows. The runs exist and match T3's own query:
GET repos/{owner}/{repo}/actions/runs?head_sha=<sha>&branch=<head>&event=pull_request&status=action_required
=> total_count: 5
but the server never runs that query (no listWorkflowRunsRequiringApproval / listActionRequiredRuns spans in server.trace.ndjson; listUnfinishedWorkflowRuns does run). readChecks in GitHubPullRequestProvider.ts only counts approval-gated runs for cross-repository PRs:
(pullRequest.state !== "open" || pullRequest.isCrossRepository !== true
? Effect.succeed({ runs: [], unavailable: false })
: ... cli.listWorkflowRunsRequiringApproval({ ..., isCrossRepository: true })
https://github.com/pingdotgg/t3code/blob/v0.1.11/packages/source-control-github/src/server/GitHubPullRequestProvider.ts#L334-L366
For same-repo PRs, workflowApprovalsRequired is therefore 0, and showsApproveWorkflows in PullRequestDetailPanel.tsx is false. But GitHub also gates same-repo runs, e.g. on PRs opened by github-actions[bot] (or other bots) when the repo requires approval for them.
Suggested fix: also run the action_required lookup for same-repository open PRs (or whenever any check or run reports action_required), instead of only when isCrossRepository.
Impact
Minor bug or occasional failure
Version or commit
v0.1.11 (desktop AppImage)
Environment
Linux x86_64 (SLES 15), T3 Code desktop 0.1.11 AppImage (Electron 44.10.1), gh 2.102.0
Workaround
Approve the runs on github.com ("Approve workflows to run" on the PR page), then return to T3.
I tried to reproduce this on the current build and could not.
Commit eb7cc44727 (origin/main). Not reproduced in a running app: that needs a GitHub repository set up so that runs on same-repository bot PRs wait for maintainer approval, and none was available (PRs opened with the workflow token start no runs at all, so they cannot stand in). Instead I confirmed it in code and with a unit test. In packages/source-control-github/src/server/GitHubPullRequestProvider.ts, readChecks returns { runs: [] } whenever pullRequest.isCrossRepository !== true, so listWorkflowRunsRequiringApproval is never called for same-repo PRs. GitHubPullRequestApi.ts (~line 2822, the approve path) also returns early for same-repo PRs. I added the test 'counts same-repository workflow runs awaiting approval' to GitHubPullRequestProvider.test.ts. It mocks an open same-repo PR (isCrossRepository false) whose approval lookup returns one action_required run, and it fails on main with 'expected +0 to be 1' on workflowApprovalsRequired. The other 33 tests in the file pass. vp test run src/server/GitHubPullRequestProvider.test.ts in packages/source-control-github.
Closing as not planned. If it still happens for you, reply with the exact steps and the version you are on and it will be looked at again.
Looks like something did change in 0.1.13 where now I can see the approved workflow run! thanks!