Repository navigation
101 lines (80 loc) · 3.96 KB
/
Copy pathsync-templates.yaml
File metadata and controls
101 lines (80 loc) · 3.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
name: Sync PR templates
# Keep fixture bodies coupled to the upstream PR templates: vendor the live
# template, re-render the fixture bodies from it, refresh the expected-effect
# files, and open a PR when anything changed — its diff shows the template
# change, the regenerated bodies, and the effect fallout in one place. A
# removed or reworded checkbox that a fixture ticks fails the render step,
# turning the scheduled run red instead of silently drifting.
on:
schedule:
- cron: "17 5 * * 1"
workflow_dispatch:
permissions:
contents: write
pull-requests: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Set up mise
# Installs the Node and pnpm versions pinned in .mise.toml.
uses: jdx/mise-action@b44d12e7d0d8ee7461bb893e1b1993500433185b # v5.2.7
- name: Locate pnpm store
run: echo "STORE_PATH=$(pnpm store path --silent)" >> "$GITHUB_ENV"
- name: Cache pnpm store
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ env.STORE_PATH }}
key: pnpm-store-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
restore-keys: pnpm-store-${{ runner.os }}-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Vendor the upstream PR templates
run: mise run sync-templates
- name: Detect template changes
id: template
# Stop early when the vendored template is unchanged
run: echo "changed=$(git diff --quiet && echo false || echo true)" >> "$GITHUB_OUTPUT"
- name: Refresh expected effects
if: steps.template.outputs.changed == 'true'
run: UPDATE_FIXTURES=1 mise run test
- name: Open a pull request
if: steps.template.outputs.changed == 'true'
uses: peter-evans/create-pull-request@15733dbdfeedb4f7fdb73d13c6f5ac83b710fab8 # v8.1.2
with:
branch: bot/sync-pr-templates
delete-branch: true
commit-message: "chore: sync fixture bodies with the upstream PR template"
title: "chore: sync fixture bodies with the upstream PR template"
body: |
## Proposed change
The upstream PR template changed. This PR vendors the new template,
re-renders the fixture bodies from it, and refreshes the expected
effects — review that diff for behavioral fallout (e.g. a
type-of-change label disappearing means a rule no longer matches
the reworded checkbox).
## Type of change
- [ ] Dependency upgrade
- [ ] Bugfix
- [ ] New rule or command
- [ ] New repository manifest (enable the bot on another repo)
- [ ] New feature (which adds functionality to an existing engine)
- [x] Code quality improvement or refactor (incl. tests)
## Additional information
- This PR was opened automatically by the scheduled
`sync-templates` workflow.
## Checklist
- [ ] I understand the code I am submitting and can explain how it works.
- [ ] The code change is tested and works locally.
- [ ] Local tests pass (`mise run test`). **Your PR cannot be merged unless tests pass.**
- [ ] Lint and type checks pass (`mise run check`).
- [ ] The code has been formatted (`mise run format`).
- [ ] Tests have been added to verify that the new code works.
- [ ] There is no commented out or debug code in this PR.
- [ ] Any generated code has been carefully reviewed for correctness and compliance with project standards.
If behaviour, configuration, or environment variables changed:
- [ ] `README.md` and `.env.example` have been updated accordingly.