Skip to content

Commit 4ac6202

Browse files
renovate[bot]trlyampcode-com
authored
chore(deps): update javascript demos (#34)
* chore(deps): update javascript demos * fix(ci): add mise tool caching with split binary/installs and rate limit protection - Split mise binary and tool installs into separate caches to prevent version drift - Authenticate GitHub API calls to avoid rate limits during version resolution and tool downloads - Enforce mise binary version after cache restore to prevent cache poisoning - Improve PR cache reuse by prioritizing base branch restoration - Add ~/.cache/mise to reduce network calls for tool downloads Amp-Thread-ID: https://ampcode.com/threads/T-fe50fb66-bde8-4eb7-809c-b8dc945dcf01 Co-authored-by: Amp <[email protected]> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Travis Lyons <[email protected]> Co-authored-by: Amp <[email protected]>
1 parent a9a92c6 commit 4ac6202

File tree

3 files changed

+66
-20
lines changed

3 files changed

+66
-20
lines changed

.github/actions/setup-mise/action.yml

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,66 @@ inputs:
66
description: Directory containing .mise.toml
77
required: true
88
default: '.'
9+
mise-version:
10+
description: mise version (e.g., v2024.9.4). Use 'latest' to auto-resolve.
11+
required: false
12+
default: 'latest'
913

1014
runs:
1115
using: composite
1216
steps:
13-
- name: Install mise
17+
- name: Resolve mise version
18+
id: resolve-mise-version
1419
shell: bash
20+
env:
21+
GITHUB_TOKEN: ${{ github.token }}
1522
run: |
16-
curl https://mise.run | sh
17-
echo "$HOME/.local/bin" >> $GITHUB_PATH
23+
ver="${{ inputs.mise-version }}"
24+
if [ "$ver" = "latest" ]; then
25+
ver="$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" -H "Accept: application/vnd.github+json" https://api.github.com/repos/jdx/mise/releases/latest | jq -r .tag_name)"
26+
fi
27+
echo "version=$ver" >> "$GITHUB_OUTPUT"
28+
29+
- name: Cache mise binary
30+
uses: actions/cache@v4
31+
with:
32+
path: ~/.local/bin/mise
33+
key: mise-bin-${{ runner.os }}-${{ steps.resolve-mise-version.outputs.version }}
34+
35+
- name: Install/Update mise
36+
shell: bash
37+
env:
38+
TARGET_VER: ${{ steps.resolve-mise-version.outputs.version }}
39+
run: |
40+
set -euo pipefail
41+
mkdir -p "$HOME/.local/bin"
42+
current_ver="$(command -v mise >/dev/null 2>&1 && mise --version | awk '{print $2}' || echo '')"
43+
if [ "$current_ver" != "$TARGET_VER" ]; then
44+
curl -fsSL https://mise.run | MISE_VERSION="$TARGET_VER" sh
45+
fi
46+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
47+
48+
- name: Cache mise installs
49+
uses: actions/cache@v4
50+
with:
51+
path: |
52+
~/.local/share/mise
53+
~/.cache/mise
54+
key: mise-installs-${{ runner.os }}-${{ steps.resolve-mise-version.outputs.version }}-${{ github.ref }}-${{ hashFiles(format('{0}/.mise.toml', inputs.working-directory), format('{0}/.tool-versions', inputs.working-directory)) }}
55+
restore-keys: |
56+
mise-installs-${{ runner.os }}-${{ steps.resolve-mise-version.outputs.version }}-refs/heads/${{ github.base_ref }}-
57+
mise-installs-${{ runner.os }}-${{ steps.resolve-mise-version.outputs.version }}-${{ github.ref }}-
58+
mise-installs-${{ runner.os }}-${{ steps.resolve-mise-version.outputs.version }}-
1859
1960
- name: Install tools via mise
2061
shell: bash
2162
working-directory: ${{ inputs.working-directory }}
63+
env:
64+
GITHUB_TOKEN: ${{ github.token }}
2265
run: |
23-
mise trust
66+
set -euo pipefail
67+
mise trust --yes
2468
mise install
25-
mise exec -- task --version || mise exec -- go install github.com/go-task/task/v3/cmd/task@latest
69+
if ! mise exec -- task --version >/dev/null 2>&1; then
70+
mise exec -- go install github.com/go-task/task/v3/cmd/task@latest
71+
fi

amp_demos/javascript/svelte/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
},
1010
"devDependencies": {
1111
"@sveltejs/adapter-auto": "^6.1.1",
12-
"@sveltejs/kit": "^2.42.2",
12+
"@sveltejs/kit": "^2.44.0",
1313
"@sveltejs/vite-plugin-svelte": "^6.2.1",
1414
"svelte": "^5.39.8",
15-
"typescript": "^5.9.2",
15+
"typescript": "^5.9.3",
1616
"vite": "^7.1.9"
1717
},
1818
"type": "module"

amp_demos/javascript/svelte/pnpm-lock.yaml

Lines changed: 13 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)