From 67c633396eea1d34ee5565de56250f5aac48e5c7 Mon Sep 17 00:00:00 2001 From: Hy4ri Date: Fri, 19 Jun 2026 17:57:22 +0300 Subject: [PATCH] ci: cache ktlint binary in GitHub Actions workflows --- .github/workflows/android.yml | 14 +++++++++++++- .github/workflows/release.yml | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 13f026b8..8d2bf9c9 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -45,11 +45,23 @@ jobs: - name: Grant Execute Permission for Gradlew run: chmod +x gradlew + - name: Cache ktlint + id: cache-ktlint + uses: actions/cache@v4 + with: + path: ~/.local/bin/ktlint + key: ktlint-1.2.1 + - name: Install ktlint + if: steps.cache-ktlint.outputs.cache-hit != 'true' run: | + mkdir -p ~/.local/bin curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.2.1/ktlint chmod +x ktlint - sudo mv ktlint /usr/local/bin/ + mv ktlint ~/.local/bin/ + + - name: Add local bin to PATH + run: echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Run ktlintCheck run: ./gradlew ktlintCheck diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 43acca18..38926360 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,11 +44,23 @@ jobs: - name: Grant Execute Permission for Gradlew run: chmod +x gradlew + - name: Cache ktlint + id: cache-ktlint + uses: actions/cache@v4 + with: + path: ~/.local/bin/ktlint + key: ktlint-1.2.1 + - name: Install ktlint + if: steps.cache-ktlint.outputs.cache-hit != 'true' run: | + mkdir -p ~/.local/bin curl -sSLO https://github.com/pinterest/ktlint/releases/download/1.2.1/ktlint chmod +x ktlint - sudo mv ktlint /usr/local/bin/ + mv ktlint ~/.local/bin/ + + - name: Add local bin to PATH + run: echo "$HOME/.local/bin" >> $GITHUB_PATH - name: ktlintCheck run: ./gradlew ktlintCheck