Support commit hash checkouts in setup-flutter
Update README Actions Table / update-readme (push) Failing after 4s

This commit is contained in:
2026-08-22 22:06:43 -07:00
parent a2aba38c5f
commit 733fd54800
+25 -9
View File
@@ -2,7 +2,7 @@ name: 'Setup Flutter'
description: 'Cross-platform setup for Flutter with caching on macOS, Windows, and Linux.'
inputs:
version:
description: 'Flutter channel or version tag (e.g., master, stable, 3.29.0)'
description: 'Flutter channel, version tag, or commit hash (e.g., master, stable, 3.29.0, 4ebf37fe7df0a130ba5bee17315b98f905c10b34)'
required: false
default: 'master'
mirror_url:
@@ -61,14 +61,22 @@ runs:
fi
if [ ! -d "$SDK_DIR/.git" ] || [ ! -f "$SDK_DIR/bin/flutter" ]; then
echo "Cloning Flutter ${{ inputs.version }} from $CLONE_URL to $SDK_DIR..."
echo "Cloning Flutter SDK to $SDK_DIR..."
rm -rf "$SDK_DIR"
git clone --depth 1 --branch ${{ inputs.version }} "$CLONE_URL" "$SDK_DIR" || {
git clone "$CLONE_URL" "$SDK_DIR" || {
echo "Failed to clone from mirror, falling back to GitHub..."
git clone --depth 1 --branch ${{ inputs.version }} https://github.com/flutter/flutter.git "$SDK_DIR"
git clone https://github.com/flutter/flutter.git "$SDK_DIR"
}
git -C "$SDK_DIR" checkout "${{ inputs.version }}"
else
echo "Flutter SDK already present at $SDK_DIR. Ready to use."
CURRENT_COMMIT=$(git -C "$SDK_DIR" rev-parse HEAD 2>/dev/null || true)
if [ "$CURRENT_COMMIT" != "${{ inputs.version }}" ] && [ "${{ inputs.version }}" != "master" ]; then
echo "Checking out Flutter ${{ inputs.version }}..."
git -C "$SDK_DIR" fetch origin "${{ inputs.version }}" --depth=1 2>/dev/null || git -C "$SDK_DIR" fetch origin
git -C "$SDK_DIR" checkout "${{ inputs.version }}"
else
echo "Flutter SDK already at ${{ inputs.version }}. Ready to use."
fi
fi
rm -rf "$LOCK_DIR" || true
@@ -97,15 +105,23 @@ runs:
}
if (-not (Test-Path "$sdkDir\bin\flutter.bat")) {
echo "Cloning Flutter ${{ inputs.version }} from $cloneUrl to $sdkDir..."
echo "Cloning Flutter SDK to $sdkDir..."
try {
git clone --depth 1 --branch ${{ inputs.version }} $cloneUrl $sdkDir
git clone $cloneUrl $sdkDir
} catch {
echo "Failed to clone from mirror, falling back to GitHub..."
git clone --depth 1 --branch ${{ inputs.version }} https://github.com/flutter/flutter.git $sdkDir
git clone https://github.com/flutter/flutter.git $sdkDir
}
git -C $sdkDir checkout "${{ inputs.version }}"
} else {
echo "Flutter SDK already present at $sdkDir. Ready to use."
$currentCommit = git -C $sdkDir rev-parse HEAD 2>$null
if ($currentCommit -ne "${{ inputs.version }}" -and "${{ inputs.version }}" -ne "master") {
echo "Checking out Flutter ${{ inputs.version }}..."
git -C $sdkDir fetch origin
git -C $sdkDir checkout "${{ inputs.version }}"
} else {
echo "Flutter SDK already at ${{ inputs.version }}. Ready to use."
}
}
if (Test-Path $lockDir) {