Skip to content

Commit

Permalink
feat: add action to install sqruff
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed May 15, 2024
1 parent de1a2d7 commit c304534
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI for Sqruff CLI Action

on: [push, pull_request]

jobs:
test-action:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Test Install Without Version
uses: ./

- name: Test Install Latest Version
uses: ./
with:
version: 'latest'

- name: Test Install Specific Version
uses: ./
with:
version: 'v0.4.0'
- name: Verify Installation
run: sqruff --version
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# install-sqruff-cli-action-
# install-sqruff-cli-action

GitHub Action to install sqruff
29 changes: 29 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: 'Install Sqruff CLI'
description: 'Installs the Sqruff CLI on Ubuntu'
branding:
color: black
icon: arrow-down-circle
inputs:
version:
description: 'Version of Sqruff CLI to install'
required: false
default: 'latest'
runs:
using: 'composite'
steps:
- run: |
if [ "${{ inputs.version }}" = "latest" ]; then
# Fetch the latest release tag from GitHub API without authentication
LATEST_VERSION=$(curl -s https://api.github.com/repos/quarylabs/sqruff/releases/latest | grep 'tag_name' | cut -d '"' -f 4)
echo "Latest version is $LATEST_VERSION"
VERSION=$LATEST_VERSION
else
VERSION=${{ inputs.version }}
fi
echo "Installing Sqruff CLI version $VERSION"
wget https://github.com/quarylabs/sqruff/releases/download/$VERSION/sqruff-linux-x86_64-gnu.zip -O sqruff-cli.zip
unzip sqruff-cli.zip -d sqruff-cli
sudo mv sqruff-cli/sqruff /usr/local/bin/sqruff
sqruff --version
shell: bash

0 comments on commit c304534

Please sign in to comment.