Skip to content

Commit c1ce57b

Browse files
committed
docs(tailwindcss-patch): add github actions validate template
1 parent b9f45d0 commit c1ce57b

5 files changed

Lines changed: 75 additions & 0 deletions

File tree

.changeset/dirty-queens-wave.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
"tailwindcss-patch": patch
3+
---
4+
5+
Add a reusable GitHub Actions template for migration report validation.
6+
7+
- add `packages/tailwindcss-patch/examples/github-actions/validate-migration-report.yml`
8+
- document how to map validate exit codes (`21/22/23/24`) in CI workflows
9+
- link the example template from README and migration notes

packages/tailwindcss-patch/MIGRATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ Migration mapping:
9595
- `tw-patch validate` can validate migration report compatibility in dry-run mode without restoring files.
9696
- `tw-patch validate` now uses dedicated failure exit codes for CI diagnostics (`21`/`22`/`23`/`24`).
9797
- `tw-patch validate --json` now emits a stable discriminated payload (`ok: true` success / `ok: false` failure with `reason` + `exitCode`), covered by `tailwindcss-patch/validate-result.schema.json`.
98+
- A ready-to-use GitHub Actions example is available at `packages/tailwindcss-patch/examples/github-actions/validate-migration-report.yml`.
9899
- Migration report tooling now has public exports from package entry (`migrateConfigFiles`, `restoreConfigFiles`, report constants/types) and published JSON schema subpaths: `tailwindcss-patch/migration-report.schema.json`, `tailwindcss-patch/restore-result.schema.json`, `tailwindcss-patch/validate-result.schema.json`.
99100
- Commands resolve configuration from `tailwindcss-patch.config.ts` via `@tailwindcss-mangle/config`. Existing configuration files continue to work without changes.
100101

packages/tailwindcss-patch/README-cn.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ case "$status" in
138138
esac
139139
```
140140

141+
GitHub Actions 模板:`packages/tailwindcss-patch/examples/github-actions/validate-migration-report.yml`
142+
141143
### `tokens` 常用参数
142144

143145
| 参数 | 说明 |

packages/tailwindcss-patch/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ case "$status" in
195195
esac
196196
```
197197

198+
GitHub Actions template: `packages/tailwindcss-patch/examples/github-actions/validate-migration-report.yml`.
199+
198200
### Token report options
199201

200202
| Flag | Description |
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Validate Tailwind Patch Migration Report
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
validate-migration-report:
12+
runs-on: ubuntu-latest
13+
timeout-minutes: 10
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v6
18+
19+
- name: Setup pnpm
20+
uses: pnpm/action-setup@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v6
24+
with:
25+
node-version: 20
26+
cache: pnpm
27+
cache-dependency-path: pnpm-lock.yaml
28+
29+
- name: Install dependencies
30+
run: pnpm install --frozen-lockfile
31+
32+
- name: Ensure migration report is up-to-date
33+
run: pnpm dlx tw-patch migrate --workspace --check --report-file .tw-patch/migrate-report.json
34+
35+
- name: Validate migration report
36+
shell: bash
37+
run: |
38+
mkdir -p .tw-patch
39+
set +e
40+
pnpm dlx tw-patch validate --report-file .tw-patch/migrate-report.json --strict --json > .tw-patch/validate-result.json
41+
status=$?
42+
set -e
43+
44+
if [ "$status" -ne 0 ]; then
45+
cat .tw-patch/validate-result.json
46+
fi
47+
48+
case "$status" in
49+
0) echo "validate ok" ;;
50+
21) echo "::error::Migration report schema/kind incompatible"; exit 1 ;;
51+
22) echo "::error::Missing backups under --strict"; exit 1 ;;
52+
23) echo "::error::I/O failure while reading report/backups"; exit 1 ;;
53+
*) echo "::error::Unknown validate failure (exit $status)"; exit "$status" ;;
54+
esac
55+
56+
- name: Upload validate result
57+
if: always()
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: tw-patch-validate-result
61+
path: .tw-patch/validate-result.json

0 commit comments

Comments
 (0)