Skip to content

Auto-refresh: fetch dispatched docs ref and bump the pin - #8

Open
franco-zalamena-iterable wants to merge 1 commit into
mainfrom
auto-refresh-from-docs-dispatch
Open

Auto-refresh: fetch dispatched docs ref and bump the pin#8
franco-zalamena-iterable wants to merge 1 commit into
mainfrom
auto-refresh-from-docs-dispatch

Conversation

@franco-zalamena-iterable

Copy link
Copy Markdown
Contributor

What

Make the docs auto-refresh actually produce a PR when Iterable's docs change. This is the skill-repo half of the auto-update the docs team asked for — the counterpart to the sender workflow that belongs in iterable-docs (modeled on iterable-docs#1489).

Why

refresh-docs.yml already listens for an iterable-docs-changed repository_dispatch. But fetch:sources always read the frozen source.ref pinned in pipeline/config/android.yml, so even when a dispatch fired, the fetch pulled the same commit, the git diff was empty, and no PR ever opened. The receiver was wired but inert.

Changes

  • fetch.ts — honor a SOURCE_REF env override to fetch from a specific commit instead of the config pin. Unset (local/manual runs) → the pin is used, behavior unchanged.
  • set-source-ref.ts (new) + set:source-ref script — comment-preserving write-back of source.ref / ref_label into pipeline/config. Guarded to a 40-hex sha (won't pin a mutable branch), and a no-op when already pinned there (safe to call unconditionally).
  • refresh-docs.yml — new "Resolve source ref" step turns client_payload.ref (or the docs default-branch head on a manual run) into a full commit sha, passes it to the fetch, and bumps the config pin in the same PR so provenance stays honest. Reviewer steps + PR body updated to mention the bump.

Design notes

  • Pin stays honest (Option A from the plan). Rather than drop the pin, the refresh advances it to the exact docs commit it fetched — so re-running an old workflow still reproduces its fetch, and diffs continue to reflect only new upstream changes.
  • Still human-gated. The workflow opens a PR; it does not auto-merge. Doc refreshes remain reviewer-approved per REVIEW.md. "Auto-update" = PR opened automatically.

Validation

  • pnpm check:all green (typecheck, polished schema, validate-plugins, snapshot verify).
  • set:source-ref tested locally: bumps ref + label, preserves all config comments, no-ops on an already-pinned sha, and rejects a non-sha ref.
  • refresh-docs.yml parses; step order is Resolve → Fetch → Polish → Detect → Bump → Open PR.

Still needed for end-to-end auto-update (in iterable-docs, not this PR)

The sender workflow + a cross-repo dispatch token. See docs/AUTO_REFRESH_PLAN.md for the full two-repo plan and the open questions for the docs team.

🤖 Generated with Claude Code

The refresh workflow could be triggered by an iterable-docs dispatch, but
fetch:sources always read the frozen `source.ref` in pipeline/config — so a
dispatch pulled the same pinned commit, the diff was empty, and no PR opened.
This closes that gap (Gap 2 of the auto-refresh plan; the sender workflow in
iterable-docs is the other half, modeled on iterable-docs#1489).

- fetch.ts: honor a SOURCE_REF env override; unset → the config pin is used,
  so local/manual runs are unchanged.
- set-source-ref.ts (new) + set:source-ref script: comment-preserving
  write-back of source.ref/ref_label into pipeline/config, guarded to a
  40-hex sha, no-op when already pinned there.
- refresh-docs.yml: resolve client_payload.ref (or the docs default-branch
  head on a manual run) to a full commit sha, fetch at that sha, and bump the
  pin in the same PR so provenance stays honest. Reviewer steps updated.

The PR is still opened, not merged — refreshes stay human-gated (REVIEW.md).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant