|
| 1 | +name: Issue 25 beta7 escaped test sync |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - issue-25-beta7 |
| 7 | + paths: |
| 8 | + - .github/workflows/issue25-beta7-test-sync.yml |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: write |
| 12 | + |
| 13 | +jobs: |
| 14 | + sync: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v4 |
| 18 | + with: |
| 19 | + ref: issue-25-beta7 |
| 20 | + fetch-depth: 0 |
| 21 | + |
| 22 | + - name: Update escaped release assertions only |
| 23 | + shell: bash |
| 24 | + run: | |
| 25 | + python3 - <<'PY' |
| 26 | + from pathlib import Path |
| 27 | +
|
| 28 | + patterns = [ |
| 29 | + (r"0\.6\.0-beta\.6", r"0\.6\.0-beta\.7"), |
| 30 | + (r"0\\.6\\.0-beta\\.6", r"0\\.6\\.0-beta\\.7"), |
| 31 | + ] |
| 32 | + changed = [] |
| 33 | + replacements = 0 |
| 34 | + for path in Path("tests").rglob("*.mjs"): |
| 35 | + text = path.read_text(encoding="utf-8") |
| 36 | + original = text |
| 37 | + for old, new in patterns: |
| 38 | + count = text.count(old) |
| 39 | + replacements += count |
| 40 | + text = text.replace(old, new) |
| 41 | + if text != original: |
| 42 | + path.write_text(text, encoding="utf-8") |
| 43 | + changed.append(str(path)) |
| 44 | +
|
| 45 | + if replacements < 7: |
| 46 | + raise SystemExit(f"Unexpectedly few escaped beta.6 assertions replaced: {replacements}") |
| 47 | +
|
| 48 | + leftovers = [] |
| 49 | + for path in Path("tests").rglob("*.mjs"): |
| 50 | + text = path.read_text(encoding="utf-8") |
| 51 | + if any(old in text for old, _ in patterns): |
| 52 | + leftovers.append(str(path)) |
| 53 | + if leftovers: |
| 54 | + raise SystemExit(f"Escaped beta.6 assertions remain: {leftovers}") |
| 55 | +
|
| 56 | + print(f"Replaced {replacements} escaped beta.6 assertions in {len(changed)} test files") |
| 57 | + for path in changed: |
| 58 | + print(path) |
| 59 | + PY |
| 60 | +
|
| 61 | + rm -f .github/workflows/issue25-beta7-test-sync.yml |
| 62 | + git config user.name "github-actions[bot]" |
| 63 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 64 | + git add tests .github/workflows/issue25-beta7-test-sync.yml |
| 65 | + git diff --cached --check |
| 66 | + git commit -m "test: sync beta.7 cache assertions" |
| 67 | + git push origin HEAD:issue-25-beta7 |
0 commit comments