-
Notifications
You must be signed in to change notification settings - Fork 165
fix(spec-sync): update PR body via REST so the LLM summary lands #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+38
−7
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
4b3117e
fix(spec-sync): update PR body via REST so the LLM summary lands
tian-lan-landing 748488f
feat(spec-sync): refresh the PR summary on human follow-up pushes
tian-lan-landing 8d91a69
fix(spec-sync): drop the push workflow; guard the body rewrite (Copilot)
tian-lan-landing File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| name: Spec Sync — refresh PR summary | ||
|
|
||
| # The inline "Summarize the PR diff" step in spec-sync.yml only runs once, when a sync PR is first | ||
| # opened, so its "## What changed" block reflects just the mechanical + AI-wiring commits. When a | ||
| # human later pushes follow-up commits to the sync branch (e.g. a breaking removal the AI didn't | ||
| # wire), this workflow re-runs the shared summarizer so the description tracks the FINAL diff. | ||
| # | ||
| # The summarizer writes into a stable <!-- what-changed:start/end --> fence, so re-running REPLACES | ||
| # that block in place (idempotent) and never disturbs body text written outside the fence. Bot | ||
| # pushes (mechanical snapshot / AI wiring) are skipped — the inline step already covers those, and | ||
| # skipping avoids a double-write race at open time. Best-effort: the script degrades to leaving the | ||
| # body untouched on any hiccup (missing PR, API error), and continue-on-error is unnecessary because | ||
| # the script itself exits 0 on every non-config failure. | ||
|
|
||
| on: | ||
| push: | ||
| branches: ['spec-sync/**'] | ||
|
|
||
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
|
|
||
| concurrency: | ||
| # One refresh per branch; a newer push supersedes an in-flight one. | ||
| group: spec-sync-summary-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| refresh-summary: | ||
| # Only recompute for human follow-up commits. The mechanical commit is authored by | ||
| # spec-sync@users.noreply.github.com and the AI-wiring commit by a *[bot] account; both are | ||
| # already summarized inline in spec-sync.yml. | ||
| if: >- | ||
| github.event.deleted != true && | ||
| github.event.head_commit != null && | ||
| !contains(github.event.head_commit.author.email, '[bot]') && | ||
| github.event.head_commit.author.email != 'spec-sync@users.noreply.github.com' | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 # summarize-pr.sh diffs origin/main...HEAD | ||
|
|
||
| - name: Refresh the PR "What changed" summary | ||
| env: | ||
| GH_TOKEN: ${{ secrets.SPEC_SYNC_TOKEN }} | ||
| ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} | ||
| run: | | ||
| set -uo pipefail | ||
| git fetch --quiet origin main | ||
|
|
||
| branch="${GITHUB_REF_NAME}" | ||
| owner="${GITHUB_REPOSITORY%%/*}" | ||
| # Resolve the open PR for this branch via REST (needs only `repo`, unlike `gh pr view`). | ||
| url="$(gh api "repos/${GITHUB_REPOSITORY}/pulls?head=${owner}:${branch}&state=open" --jq '.[0].html_url // ""')" | ||
| if [ -z "$url" ]; then | ||
| echo "No open PR for ${branch}; nothing to refresh." | ||
| exit 0 | ||
| fi | ||
|
|
||
| # V2 excludes the hand-maintained /v2/workflow* surface from "What changed". Keep this in | ||
| # sync with the SUMMARY_SCOPE_NOTE on the V2 job in spec-sync.yml. | ||
| if [ "$branch" = "spec-sync/v2" ]; then | ||
| export SUMMARY_SCOPE_NOTE='Scope: this SDK intentionally does NOT implement /v2/workflow, /v2/workflow/jobs, or /v2/workflow/jobs/{job_id}; that surface is deferred and is not wired into the client. Do not describe any /v2/workflow* route as a client/SDK change. If the diff touches only workflow, say the spec snapshot was updated but no client surface changed.' | ||
| fi | ||
|
|
||
| ./scripts/spec-sync/summarize-pr.sh "$url" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.