Skip to content

Commit a551545

Browse files
Merge branch 'main' into feat/notes-mirror-readonly
2 parents 1212ab3 + 7f63dba commit a551545

3 files changed

Lines changed: 83 additions & 6 deletions

File tree

.github/workflows/bump-nix-package.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ on:
1010
required: true
1111
type: string
1212

13+
# GITHUB_TOKEN only pushes the branch here — the PR itself is opened with the
14+
# PAT below, so no `pull-requests: write` is needed (and it never worked).
1315
permissions:
1416
contents: write
15-
pull-requests: write
1617

1718
jobs:
1819
bump:
@@ -78,7 +79,13 @@ jobs:
7879
7980
- name: Create PR
8081
env:
81-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
82+
# NOT GITHUB_TOKEN: the repo has "Allow GitHub Actions to create and
83+
# approve pull requests" turned off, so `gh pr create` dies with
84+
# "GitHub Actions is not permitted to create or approve pull requests"
85+
# — it did exactly that on v1.7.0, after pushing the branch, and #136
86+
# had to be opened by hand. The PAT every other release workflow
87+
# already uses has no such restriction, and its PRs trigger CI.
88+
GH_TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
8289
VERSION: ${{ steps.meta.outputs.version }}
8390
HASH: ${{ steps.hash.outputs.hash }}
8491
BRANCH: ${{ steps.meta.outputs.branch }}
@@ -112,7 +119,5 @@ jobs:
112119
- \`npmDepsHash\` → \`${HASH}\` (computed via \`prefetch-npm-deps package-lock.json\`)
113120
114121
Merge this so Nix users (NixOS, Home Manager, \`nix run github:${{ github.repository }}\`) pick up the new release.
115-
116-
> Note: PRs opened by \`GITHUB_TOKEN\` don't auto-trigger CI. The diff is two lines — review the change here, then merge. If you want CI to run, push an empty commit to this branch or close-and-reopen the PR.
117122
EOF
118123
)"

.github/workflows/nix-check.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Nix
2+
3+
# nix/package.nix records `npmDepsHash`, a hash of the npm dependency set that
4+
# package-lock.json resolves to. The two have to agree or `nix build` fails
5+
# outright, and nothing here ever checked that they did.
6+
#
7+
# The only thing that refreshed the hash was bump-nix-package.yml, which fires
8+
# on stable releases. `src` is this repo's own tree, not a fetched tarball, so
9+
# every lockfile change landing between two releases left main's hash pointing
10+
# at dependencies that no longer existed. It last matched on 2026-07-05 (v1.6.0)
11+
# while package-lock.json moved ten more times, so `nix run github:…` was broken
12+
# for four weeks with nothing reporting it.
13+
#
14+
# Release-time bumps can't fix that — the drift starts the moment a lockfile PR
15+
# merges. This runs on the PR that causes it and prints the hash to paste.
16+
on:
17+
pull_request:
18+
paths:
19+
- package-lock.json
20+
- nix/**
21+
- .github/workflows/nix-check.yml
22+
# Same branch list as ci.yml, and for the reason its own comment gives: a
23+
# release branch is the last place to skip a check. PRs need no filter here —
24+
# the trigger above has none, so they are covered wherever they land — but a
25+
# direct push or a rebase force-push onto a long-lived branch is not a PR and
26+
# would otherwise go unchecked.
27+
push:
28+
branches: [main, feat/ai-edition, "release/**"]
29+
paths:
30+
- package-lock.json
31+
- nix/**
32+
- .github/workflows/nix-check.yml
33+
34+
# Read-only, and stated rather than inherited: the repo default happens to be
35+
# `read` today, which is exactly the kind of repo-level setting that silently
36+
# changed this workflow's sibling out from under it.
37+
permissions:
38+
contents: read
39+
40+
jobs:
41+
npm-deps-hash:
42+
name: npmDepsHash matches package-lock.json
43+
runs-on: ubuntu-latest
44+
steps:
45+
- uses: actions/checkout@v4
46+
47+
- uses: cachix/install-nix-action@v27
48+
with:
49+
nix_path: nixpkgs=channel:nixos-unstable
50+
extra_nix_config: |
51+
experimental-features = nix-command flakes
52+
53+
- name: Compare recorded hash against the lockfile
54+
run: |
55+
set -euo pipefail
56+
EXPECTED=$(nix run nixpkgs#prefetch-npm-deps -- package-lock.json)
57+
RECORDED=$(sed -nE 's|^[[:space:]]*npmDepsHash[[:space:]]*=[[:space:]]*"([^"]*)";|\1|p' nix/package.nix)
58+
59+
echo "recorded in nix/package.nix: ${RECORDED:-<none>}"
60+
echo "expected from package-lock.json: $EXPECTED"
61+
62+
if [[ -z "$EXPECTED" ]]; then
63+
echo "::error::prefetch-npm-deps returned an empty hash"
64+
exit 1
65+
fi
66+
67+
if [[ "$EXPECTED" != "$RECORDED" ]]; then
68+
echo "::error file=nix/package.nix::npmDepsHash is stale — set it to $EXPECTED"
69+
exit 1
70+
fi
71+
72+
echo "In sync."

nix/package.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
buildNpmPackage {
1212
nodejs = nodejs_22;
1313
pname = "openscreen";
14-
version = "1.6.0";
14+
version = "1.7.0";
1515

1616
src =
1717
let
@@ -33,7 +33,7 @@ buildNpmPackage {
3333
);
3434
};
3535

36-
npmDepsHash = "sha256-IZypOLWlDShIjCKWxlJcrdtIkMu0P/DuXaq4c0HW3FY=";
36+
npmDepsHash = "sha256-SggSPoDnKzmvgXpIGP11y6h390SkoZszeMjFTaokRjQ=";
3737

3838
env.ELECTRON_SKIP_BINARY_DOWNLOAD = "1";
3939

0 commit comments

Comments
 (0)