Skip to content

Commit 7805329

Browse files
authored
Merge pull request quarylabs#1 from quarylabs/adding_action
feat: add action to install sqruff
2 parents de1a2d7 + bd791fe commit 7805329

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

.github/workflows/ci.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: CI for Sqruff CLI Action
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test-action:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout
10+
uses: actions/checkout@v4
11+
12+
- name: Test Install Without Version
13+
uses: ./
14+
15+
- name: Test Install Latest Version
16+
uses: ./
17+
with:
18+
version: 'latest'
19+
20+
- name: Test Install Specific Version
21+
uses: ./
22+
with:
23+
version: 'v0.4.0'
24+
- name: Verify Installation
25+
run: sqruff --version

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# install-sqruff-cli-action-
1+
# install-sqruff-cli-action
2+
23
GitHub Action to install sqruff

action.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: 'Install Sqruff CLI'
2+
description: 'Installs the Sqruff CLI on Ubuntu'
3+
branding:
4+
color: black
5+
icon: arrow-down-circle
6+
inputs:
7+
version:
8+
description: 'Version of Sqruff CLI to install'
9+
required: false
10+
default: 'latest'
11+
runs:
12+
using: 'composite'
13+
steps:
14+
- run: |
15+
if [ "${{ inputs.version }}" = "latest" ]; then
16+
# Fetch the latest release tag from GitHub API without authentication
17+
LATEST_VERSION=$(curl -s https://api.github.com/repos/quarylabs/sqruff/releases/latest | grep 'tag_name' | cut -d '"' -f 4)
18+
echo "Latest version is $LATEST_VERSION"
19+
VERSION=$LATEST_VERSION
20+
else
21+
VERSION=${{ inputs.version }}
22+
fi
23+
24+
echo "Installing Sqruff CLI version $VERSION"
25+
wget https://github.com/quarylabs/sqruff/releases/download/$VERSION/sqruff-linux-x86_64-musl.tar.gz -O sqruff-cli.tar.gz
26+
tar -xzf sqruff-cli.tar.gz
27+
sudo mv sqruff /usr/local/bin/sqruff
28+
sqruff --version
29+
shell: bash

0 commit comments

Comments
 (0)