From 26f64270b7fc3babeebe2e4df7458c2dd2321c09 Mon Sep 17 00:00:00 2001 From: LemonNeko Date: Fri, 2 Jan 2026 23:53:24 +0800 Subject: [PATCH] fix(ci): swiftlint actions template --- .github/actions/setup-swiftlint/action.yml | 33 +++++++++------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/.github/actions/setup-swiftlint/action.yml b/.github/actions/setup-swiftlint/action.yml index fd4b544c0..d12de0aeb 100644 --- a/.github/actions/setup-swiftlint/action.yml +++ b/.github/actions/setup-swiftlint/action.yml @@ -28,30 +28,25 @@ runs: exit 1 fi - - name: Get latest version - if: inputs.version == 'latest' + - name: Resolve version id: version shell: bash run: | - VERSION=$(curl -s https://api.github.com/repos/realm/SwiftLint/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') - if [[ -z "$VERSION" ]]; then - echo "Error: Failed to get latest version" - exit 1 + if [[ "${{ inputs.version }}" == "latest" ]]; then + VERSION=$(curl -s https://api.github.com/repos/realm/SwiftLint/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') + if [[ -z "$VERSION" ]]; then + echo "Error: Failed to get latest version" + exit 1 + fi + echo "Latest version: $VERSION" + else + VERSION="${{ inputs.version }}" + if [[ ! "$VERSION" =~ ^v ]]; then + VERSION="v$VERSION" + fi + echo "Using specified version: $VERSION" fi echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "Latest version: $VERSION" - - - name: Set version - if: inputs.version != 'latest' - id: version - shell: bash - run: | - VERSION="${{ inputs.version }}" - if [[ ! "$VERSION" =~ ^v ]]; then - VERSION="v$VERSION" - fi - echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "Using specified version: $VERSION" - name: Download and install SwiftLint shell: bash