forked from jflessau/sqlx-fmt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
52 lines (43 loc) · 1.35 KB
/
action.yml
File metadata and controls
52 lines (43 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: "sqlx-fmt"
description: "Check if SQL code in sqlx macros needs formatting using sqruff."
inputs:
context:
description: "Directory containing Rust files"
required: false
default: "."
config-file:
description: "Path to sqruff configuration file (.sqruff)"
required: false
default: ".sqruff"
fail-on-unformatted:
description: "Whether to fail the action if formatting changes are needed"
required: false
default: "true"
runs:
using: "composite"
steps:
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
- name: Install sqruff
uses: quarylabs/install-sqruff-cli-action@main
- name: Build sqlx-fmt
shell: bash
working-directory: ${{ github.action_path }}
run: |
cargo build --release
- name: Check SQL formatting
shell: bash
run: |
set -e
SQLX_FMT="${{ github.action_path }}/target/release/sqlx-fmt"
export SQLX_FMT_PATH="${{ inputs.context }}"
export SQLX_FMT_SQRUFF_CONFIG="${{ inputs.config-file }}"
export SQLX_FMT_FAIL_ON_UNFORMATTED="${{ inputs.fail-on-unformatted }}"
echo "Config file: $SQLX_FMT_SQRUFF_CONFIG"
echo "Fail on unformatted: $SQLX_FMT_FAIL_ON_UNFORMATTED"
"$SQLX_FMT" check
branding:
icon: "code"
color: "blue"