Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 7 additions & 18 deletions .github/workflows/update-pnpm-hash.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ jobs:

FAKE="sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
SYSTEM=$(nix eval --impure --raw --expr 'builtins.currentSystem')
CHANGED=0

# Helper: extract the hash for a given attribute, swap in FAKE,
# build it, capture the real hash, and write it back.
Expand Down Expand Up @@ -84,30 +83,20 @@ jobs:
# Write the correct hash back.
sed -i "/^[[:space:]]*${attr} = fetchPnpmDeps/,/;[[:space:]]*\$/{s|hash = \"${FAKE}\"|hash = \"${NEW}\"|}" nix/package.nix

# Track whether anything changed.
# Track whether this hash changed.
if [ "$CURRENT" != "$NEW" ]; then
echo "${attr}_changed=true" >> "$GITHUB_OUTPUT"
CHANGED=1
else
echo "${attr}_changed=false" >> "$GITHUB_OUTPUT"
fi
}

# ----- root pnpm-lock.yaml -----
if git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -qx 'pnpm-lock.yaml'; then
update_hash "pnpmDeps" "pnpm root"
fi

# ----- new-ui/pnpm-lock.yaml -----
if git diff --name-only "origin/${{ github.base_ref }}...HEAD" | grep -qx 'new-ui/pnpm-lock.yaml'; then
update_hash "newUiPnpmDeps" "pnpm new-ui"
fi

# If neither lockfile was actually modified, warn but don't fail
# (can happen when the PR touches both, then one is reverted).
if [ "$CHANGED" -eq 0 ]; then
echo "::warning::Workflow triggered but no lockfile changed relative to base."
fi
# Always attempt both hashes - the workflow trigger already ensures
# at least one lockfile was modified. The commit step below only
# fires when a hash actually changed, so there's no harm in
# computing both every time.
update_hash "pnpmDeps" "pnpm root"
update_hash "newUiPnpmDeps" "pnpm new-ui"

- name: Commit updated hashes
if: >
Expand Down
23 changes: 11 additions & 12 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nix/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
inherit pname version pnpm;
src = ../.;
fetcherVersion = 3;
hash = "sha256-WjcZeKfEEjcry5dJ12yL+dz+/v5CmKSg0iHfYcoOtag=";
hash = "sha256-D7yf3x7OAeM3Wdjgo8TxeSCNoLxN3IfgqTzRoBdBwhc=";
};

# Prefetch pnpm dependencies for the new UI (separate pnpm project).
Expand All @@ -99,7 +99,7 @@
inherit version pnpm;
src = ../new-ui;
fetcherVersion = 3;
hash = "sha256-baWUPm0kQqCpfPaKQ/XelD253ly/f2icuR/s/+6jVgE=";
hash = "sha256-N6YZ7COM99gtEBDFAKCPKWep52eY6ShxQYeJGDF/H38=";
};

# Pre-build the new UI frontend so Tauri can serve it as WebviewUrl::App("compact/") and "full/".
Expand Down
Loading