Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/update-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
bun update --latest "$package"
fi
done
- name: Close existing PRs
run: |
gh pr list --repo ${{ github.repository }} --state open --author "tscircuitbot" --json number,title --jq '.[] | select(.title | startswith("chore:")) | .number' | xargs -I{} gh pr close {} --comment "Closing in favor of a new update PR"
Comment on lines +38 to +40

Choose a reason for hiding this comment

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

P1 Badge Authenticate gh before closing existing PRs

The new Close existing PRs step invokes gh pr close without exporting GH_TOKEN or GITHUB_TOKEN with write permissions. When a previous bot PR exists, this call will run with the default token (read‑only in most workflows) and gh fails with HTTP 403: Resource not accessible by integration, stopping the whole job before it can create the new update PR. The subsequent merge step already sets GH_TOKEN to secrets.TSCIRCUIT_BOT_GITHUB_TOKEN; this step needs the same treatment to reliably close PRs.

Useful? React with 👍 / 👎.

- name: Create Pull Request
id: create-pr
uses: peter-evans/create-pull-request@v5
Expand Down
14 changes: 11 additions & 3 deletions tests/fixtures/get-test-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@ import getPort from "get-port"
import endpoint from "../../endpoint"
import { afterEach } from "bun:test"

const activeServers = new Set<ReturnType<typeof Bun.serve>>()

afterEach(() => {
for (const server of activeServers) {
server.stop()
}

activeServers.clear()
})

export const getTestServer = async () => {
const port = await getPort()

Expand All @@ -13,9 +23,7 @@ export const getTestServer = async () => {
idleTimeout: 20,
})

afterEach(() => {
server.stop()
})
activeServers.add(server)

return {
serverUrl,
Expand Down