From 302dd87f3602673f86f9c475c2157b3dcccc9576 Mon Sep 17 00:00:00 2001 From: Rody Davis Date: Tue, 13 Oct 2026 20:25:01 -0700 Subject: [PATCH] fix(setup-flutter): avoid deleting flutter.version.json when already cached to prevent concurrent pub failures --- setup-flutter/action.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/setup-flutter/action.yml b/setup-flutter/action.yml index 8d98aac..39e086e 100644 --- a/setup-flutter/action.yml +++ b/setup-flutter/action.yml @@ -72,6 +72,7 @@ runs: } git -C "$SDK_DIR" config --global --add safe.directory "$SDK_DIR" || true git -C "$SDK_DIR" checkout "$TARGET_VERSION" + rm -f "$SDK_DIR/bin/cache/flutter.version.json" else git -C "$SDK_DIR" config --global --add safe.directory "$SDK_DIR" || true CURRENT_COMMIT=$(git -C "$SDK_DIR" rev-parse HEAD 2>/dev/null || true) @@ -79,6 +80,7 @@ runs: echo "Checking out Flutter $TARGET_VERSION..." git -C "$SDK_DIR" fetch origin "$TARGET_VERSION" --depth=1 2>/dev/null || git -C "$SDK_DIR" fetch origin git -C "$SDK_DIR" checkout "$TARGET_VERSION" + rm -f "$SDK_DIR/bin/cache/flutter.version.json" else echo "Flutter SDK already at $TARGET_VERSION. Ready to use." fi @@ -96,9 +98,15 @@ runs: echo "$SDK_DIR/bin" >> "$GITHUB_PATH" if [ "${{ inputs.enable_windowing }}" = "true" ]; then - "$SDK_DIR/bin/flutter" config --enable-windowing + if ! grep -q '"enable-windowing":[[:space:]]*true' "$HOME/.flutter_settings" 2>/dev/null; then + "$SDK_DIR/bin/flutter" config --enable-windowing + fi + fi + if [ ! -f "$SDK_DIR/bin/cache/flutter.version.json" ]; then + "$SDK_DIR/bin/flutter" --version + else + cat "$SDK_DIR/bin/cache/flutter.version.json" fi - "$SDK_DIR/bin/flutter" --version rm -rf "$LOCK_DIR" || true