|
| 1 | +name: Refresh docs |
| 2 | + |
| 3 | +# Triggered when Iterable/iterable-docs publishes a change to an SDK doc |
| 4 | +# path. The docs repo dispatches `iterable-docs-changed`; this workflow |
| 5 | +# pulls the fresh markdown, runs the deterministic transform, and opens a |
| 6 | +# PR. There is no LLM step — the corpus is the docs reshaped. A reviewer |
| 7 | +# refreshes the snapshot and merges. |
| 8 | +# |
| 9 | +# `workflow_dispatch` is kept as a manual fallback for re-running a |
| 10 | +# refresh outside of a docs-side trigger (e.g. when validating a config |
| 11 | +# change on this repo). |
| 12 | + |
| 13 | +on: |
| 14 | + repository_dispatch: |
| 15 | + types: [iterable-docs-changed] |
| 16 | + workflow_dispatch: |
| 17 | + inputs: |
| 18 | + platform: |
| 19 | + description: "Platform to refresh" |
| 20 | + required: true |
| 21 | + default: "android" |
| 22 | + type: choice |
| 23 | + options: |
| 24 | + - android |
| 25 | + |
| 26 | +permissions: |
| 27 | + contents: write |
| 28 | + pull-requests: write |
| 29 | + |
| 30 | +jobs: |
| 31 | + refresh: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + steps: |
| 34 | + - name: Checkout |
| 35 | + uses: actions/checkout@v4 |
| 36 | + |
| 37 | + - name: Setup pnpm |
| 38 | + uses: pnpm/action-setup@v4 |
| 39 | + with: |
| 40 | + version: 9 |
| 41 | + |
| 42 | + - name: Setup Node |
| 43 | + uses: actions/setup-node@v4 |
| 44 | + with: |
| 45 | + node-version: 20 |
| 46 | + cache: pnpm |
| 47 | + cache-dependency-path: pipeline/pnpm-lock.yaml |
| 48 | + |
| 49 | + - name: Install pipeline deps |
| 50 | + working-directory: pipeline |
| 51 | + run: pnpm install --frozen-lockfile |
| 52 | + |
| 53 | + - name: Fetch sources (uses GITHUB_TOKEN for gh api) |
| 54 | + working-directory: pipeline |
| 55 | + env: |
| 56 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 57 | + run: pnpm fetch:sources -- ${{ github.event.inputs.platform || github.event.client_payload.platform || 'android' }} |
| 58 | + |
| 59 | + - name: Polish Layer A |
| 60 | + working-directory: pipeline |
| 61 | + run: pnpm polish:a -- --platform=${{ github.event.inputs.platform || github.event.client_payload.platform || 'android' }} |
| 62 | + |
| 63 | + - name: Detect changes |
| 64 | + id: changes |
| 65 | + run: | |
| 66 | + if git diff --quiet sources/ polished/; then |
| 67 | + echo "changed=false" >> "$GITHUB_OUTPUT" |
| 68 | + exit 0 |
| 69 | + fi |
| 70 | + echo "changed=true" >> "$GITHUB_OUTPUT" |
| 71 | + # Slugs touched in sources/ this run |
| 72 | + slugs=$(git diff --name-only sources/ \ |
| 73 | + | sed -E 's|sources/[^/]+/([^/]+)\.md|\1|' \ |
| 74 | + | sort -u | paste -sd ', ' -) |
| 75 | + echo "slugs=${slugs}" >> "$GITHUB_OUTPUT" |
| 76 | +
|
| 77 | + - name: Open refresh PR |
| 78 | + if: steps.changes.outputs.changed == 'true' |
| 79 | + uses: peter-evans/create-pull-request@v6 |
| 80 | + with: |
| 81 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 82 | + branch: refresh/${{ github.event.inputs.platform || github.event.client_payload.platform || 'android' }}-${{ github.run_id }} |
| 83 | + base: main |
| 84 | + delete-branch: true |
| 85 | + title: "docs refresh (${{ github.event.inputs.platform || github.event.client_payload.platform || 'android' }}): ${{ steps.changes.outputs.slugs }}" |
| 86 | + commit-message: | |
| 87 | + docs refresh (${{ github.event.inputs.platform || github.event.client_payload.platform || 'android' }}): Layer A only |
| 88 | +
|
| 89 | + Slugs: ${{ steps.changes.outputs.slugs }} |
| 90 | + body: | |
| 91 | + Automated refresh of `sources/` and the deterministic `polished/` |
| 92 | + corpus (Layer A). **No LLM rewrite step** — the polished corpus is |
| 93 | + a deterministic transform of the docs. |
| 94 | +
|
| 95 | + **Slugs touched:** ${{ steps.changes.outputs.slugs }} |
| 96 | +
|
| 97 | + ## Reviewer steps |
| 98 | +
|
| 99 | + 1. Check out this branch. |
| 100 | + 2. Spot-check the diff against `sources/` for content fidelity — |
| 101 | + the transform only strips boilerplate / normalizes structure, |
| 102 | + so headings and code should match the upstream docs. |
| 103 | + 3. Run `pnpm snapshot:refresh` and commit the resulting |
| 104 | + `iterable-android/snapshot/` changes. CI's `snapshot:verify` |
| 105 | + gate will fail the build otherwise. |
| 106 | + 4. Confirm `pnpm check:all` is green locally. |
| 107 | + 5. Merge to `main`. Context7 picks up the change on its next |
| 108 | + crawl (`context7.json` controls scope). |
| 109 | + labels: | |
| 110 | + docs-refresh |
| 111 | + automated |
0 commit comments