Files
Lauren Hirata Singh 3084a3d6de chore: reuse one PR for the LangSmith OpenAPI refresh (#5647)
## Why

The daily `Refresh LangSmith OpenAPI spec` workflow cut a new
timestamped branch on every run, so each day opened another PR against
the same file. Four were outstanding when I looked (#5591, #5609, #5622,
#5635), all touching only
`src/langsmith/langsmith-platform-openapi.json`.

## What changed

`.github/workflows/refresh-langsmith-openapi.yml` now uses a single
standing branch, `chore/refresh-langsmith-openapi`:

- **Open PR on that branch**: check it out, drop the regenerated spec on
it, commit, plain `git push`. The commit lands on the existing PR.
- **No open PR**: branch from `main`, commit, `git push --force`, then
`gh pr create`. The force-push covers the case where a merged PR left
the branch behind; nothing references it at that point.
- **Nothing changed**: exits without an empty commit. This now compares
against the PR branch rather than `main`, so a run that reproduces what
the PR already carries is a no-op.

The commit body carries a `Refreshed` UTC timestamp line so stacked
commits are distinguishable, and the step writes a one-line note to the
job summary saying whether it appended or opened.

## Review notes

The whole change is one shell step, so it is worth reading end to end. I
verified it by extracting the step and running it against a throwaway
repo with a stubbed `gh`, covering four cases: no open PR, open PR with
a change, open PR with no change, and a stale branch from a merged PR.
All behaved as intended. YAML parses and `bash -n` passes.

One behavioral tradeoff worth a look: while the PR stays open, its
branch does not track `main`, so CI on it runs against an increasingly
old base. That is the normal cost of a long-lived PR, and merging
promptly avoids it.

The four PRs listed above are being closed alongside this change; the
next scheduled run regenerates the spec from the live API and opens a
single replacement PR.

Written with Claude Code.

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-24 08:20:41 -04:00
..