Repository navigation
ci: auto-bump @openmouse/protocol pin daily #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,81 @@ | ||||||
| name: Bump @openmouse/protocol | ||||||
|
|
||||||
| # The desktop tracks the protocol repo's main branch as a git dependency | ||||||
| # (see package.json), but `npm ci` installs the exact commit pinned in | ||||||
| # package-lock.json — so without this job, new drivers and catalog entries | ||||||
| # sit in mouse-protocol until somebody remembers to bump by hand. This floats | ||||||
| # the pin to the newest protocol main once a day and opens (or refreshes) a | ||||||
| # PR when it moved, with a typecheck against the new .d.ts as the gate. | ||||||
| # Releases stay reproducible: release.yml keeps building via `npm ci` on | ||||||
| # whatever the lockfile pins at tag time. | ||||||
| # | ||||||
| # Note: build-windows.yml only runs on pushes to main, so a bump PR gets no | ||||||
| # compile check from it — the tsc step below is the validation, and the full | ||||||
| # build runs once the PR merges. | ||||||
|
|
||||||
| on: | ||||||
| schedule: | ||||||
| # Daily 09:00 UTC. | ||||||
| - cron: "0 9 * * *" | ||||||
| workflow_dispatch: | ||||||
|
|
||||||
| permissions: | ||||||
| contents: write | ||||||
| pull-requests: write | ||||||
|
|
||||||
| jobs: | ||||||
| bump: | ||||||
| runs-on: ubuntu-latest | ||||||
| steps: | ||||||
| - uses: actions/checkout@v4 | ||||||
|
|
||||||
| - uses: actions/setup-node@v4 | ||||||
| with: | ||||||
| node-version: lts/* | ||||||
| cache: npm | ||||||
|
|
||||||
| - name: Float protocol pin to latest main | ||||||
| id: bump | ||||||
| run: | | ||||||
| OLD_SHA="$(node -p "require('./package-lock.json').packages['node_modules/@openmouse/protocol'].resolved.split('#')[1]")" | ||||||
| echo "old-sha=$OLD_SHA" >> "$GITHUB_OUTPUT" | ||||||
| npm install "https://github.com/OpenMouse-Project/mouse-protocol.git" --no-audit --no-fund | ||||||
| NEW_SHA="$(node -p "require('./package-lock.json').packages['node_modules/@openmouse/protocol'].resolved.split('#')[1]")" | ||||||
| echo "new-sha=$NEW_SHA" >> "$GITHUB_OUTPUT" | ||||||
| if [ "$OLD_SHA" = "$NEW_SHA" ]; then | ||||||
| echo "protocol pin unchanged ($OLD_SHA)" | ||||||
| else | ||||||
| echo "protocol pin moved $OLD_SHA -> $NEW_SHA" | ||||||
| fi | ||||||
|
|
||||||
| - name: Typecheck against the new protocol | ||||||
| # Only meaningful when the pin moved; when it didn't, this just | ||||||
| # re-verifies main at low cost while the toolchain is warm. | ||||||
| # Fail-safe: if main doesn't typecheck clean, the job stops here | ||||||
| # and no bump PR goes out. | ||||||
| run: npx tsc --noEmit | ||||||
|
|
||||||
| - name: Open or refresh bump PR | ||||||
| if: steps.bump.outputs.old-sha != steps.bump.outputs.new-sha | ||||||
| env: | ||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||
| OLD_SHA: ${{ steps.bump.outputs.old-sha }} | ||||||
| NEW_SHA: ${{ steps.bump.outputs.new-sha }} | ||||||
| run: | | ||||||
| git config user.name "github-actions[bot]" | ||||||
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | ||||||
| git checkout -B chore/bump-protocol | ||||||
| # package.json is included: npm normalizes the git spec on install | ||||||
| # (one-time cosmetic change), and npm ci requires the two in sync. | ||||||
| git add package-lock.json package.json | ||||||
| git commit -m "chore(protocol): bump @openmouse/protocol to ${NEW_SHA:0:12}" | ||||||
| git push -f origin chore/bump-protocol | ||||||
| if ! gh pr view chore/bump-protocol --json number -q .number >/dev/null 2>&1; then | ||||||
| gh pr create \ | ||||||
| --head chore/bump-protocol \ | ||||||
| --base main \ | ||||||
| --title "chore(protocol): bump @openmouse/protocol to ${NEW_SHA:0:12}" \ | ||||||
| --body "Automated daily bump of the protocol pin to latest main. Typechecked in the bump job; full build runs on merge. | ||||||
|
|
||||||
| mouse-protocol compare: https://github.com/OpenMouse-Project/mouse-protocol/compare/${OLD_SHA}...${NEW_SHA}" | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win Indent the PR body inside the Line 80 starts at the YAML document level. It therefore ends the shell block and becomes an invalid workflow key. The workflow cannot load, so neither the scheduled job nor manual dispatch can run. Indent this line to match the other shell lines. The supplied actionlint result confirms the parse error. Proposed fix--- "a/.github/workflows/bump-protocol.yml"
+++ "b/.github/workflows/bump-protocol.yml"
@@ -77,5 +77,5 @@
--title "chore(protocol): bump @openmouse/protocol to ${NEW_SHA:0:12}" \
--body "Automated daily bump of the protocol pin to latest main. Typechecked in the bump job; full build runs on merge.
-mouse-protocol compare: https://github.com/OpenMouse-Project/mouse-protocol/compare/${OLD_SHA}...${NEW_SHA}"
+ mouse-protocol compare: https://github.com/OpenMouse-Project/mouse-protocol/compare/${OLD_SHA}...${NEW_SHA}"
fi📝 Committable suggestion
Suggested change
🧰 Tools🪛 actionlint (1.7.12)[error] 80-80: unexpected key "mouse-protocol compare" for "workflow" section. expected one of "concurrency", "defaults", "env", "jobs", "name", "on", "permissions", "run-name" (syntax-check) 🤖 Prompt for AI AgentsSource: Linters/SAST tools |
||||||
| fi | ||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Provide the local keyboard-protocol dependency before installing.
The manifest specifies
@openmouse/keyboard-protocolasfile:../keyboard-protocol, but this job checks out only the desktop repository. On a fresh runner, the sibling path is absent.npm installcannot supply that local dependency, and the typecheck cannot resolve its subpaths. Check out both repositories in a layout that preserves the relative path, or replace the local dependency with a resolvable package spec. npm treatsfile:entries as local paths and installs dependencies declared by the manifest. (docs.npmjs.com)🧰 Tools
🪛 zizmor (1.30.1)
[warning] 42-42: ad-hoc installation of packages (adhoc-packages): installs a package outside of a lockfile
(adhoc-packages)
🤖 Prompt for AI Agents