|
| 1 | +# |
| 2 | +# © 2026-present https://github.com/cengiz-pz |
| 3 | +# |
| 4 | + |
| 5 | +name: Install editorconfig-checker |
| 6 | +description: Installs a pinned version of editorconfig-checker with caching. |
| 7 | + |
| 8 | +inputs: |
| 9 | + version: |
| 10 | + description: 'The version of editorconfig-checker to install' |
| 11 | + required: false |
| 12 | + default: '3.6.1' |
| 13 | + |
| 14 | +runs: |
| 15 | + using: composite |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Cache editorconfig-checker |
| 19 | + id: cache-ec |
| 20 | + # Skip caching when running locally via 'act' to avoid missing Node/Docker execution errors |
| 21 | + if: env.ACT != 'true' |
| 22 | + uses: actions/cache@v5 |
| 23 | + with: |
| 24 | + path: ~/.local/bin/editorconfig-checker |
| 25 | + key: ${{ runner.os }}-${{ runner.arch }}-ec-${{ inputs.version }} |
| 26 | + |
| 27 | + - name: Install editorconfig-checker |
| 28 | + # This runs if there's a cache miss OR if the cache step was skipped entirely |
| 29 | + if: steps.cache-ec.outputs.cache-hit != 'true' |
| 30 | + shell: bash |
| 31 | + run: | |
| 32 | + # Determine OS and Architecture |
| 33 | + OS_TYPE=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]') |
| 34 | + ARCH_TYPE=$(uname -m) |
| 35 | + |
| 36 | + # Map architecture to release naming conventions |
| 37 | + if [ "$ARCH_TYPE" = "x86_64" ]; then |
| 38 | + ARCH="amd64" |
| 39 | + elif [ "$ARCH_TYPE" = "aarch64" ] || [ "$ARCH_TYPE" = "arm64" ]; then |
| 40 | + ARCH="arm64" |
| 41 | + else |
| 42 | + echo "Unsupported architecture: $ARCH_TYPE" |
| 43 | + exit 1 |
| 44 | + fi |
| 45 | + |
| 46 | + ASSET="ec-${OS_TYPE}-${ARCH}" |
| 47 | +
|
| 48 | + echo "Downloading ${ASSET}..." |
| 49 | + curl -sSLO "https://github.com/editorconfig-checker/editorconfig-checker/releases/download/v${{ inputs.version }}/${ASSET}.tar.gz" |
| 50 | + |
| 51 | + tar xzf "${ASSET}.tar.gz" |
| 52 | + mkdir -p "$HOME/.local/bin" |
| 53 | + mv "bin/${ASSET}" "$HOME/.local/bin/editorconfig-checker" |
| 54 | + chmod +x "$HOME/.local/bin/editorconfig-checker" |
| 55 | + |
| 56 | + # Clean up |
| 57 | + rm -rf "${ASSET}.tar.gz" bin/ |
| 58 | +
|
| 59 | + - name: Add to PATH |
| 60 | + shell: bash |
| 61 | + run: echo "$HOME/.local/bin" >> "$GITHUB_PATH" |
0 commit comments