Skip to content

Commit

Permalink
Extract actions/setup-python@v2 (#3)
Browse files Browse the repository at this point in the history
* Extract `actions/setup-python@v2`

* Fix
  • Loading branch information
yu-iskw authored Dec 23, 2021
1 parent 429ea7a commit bd5886c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ jobs:
test-check:
name: runner / sqlfluff (github-check)
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- uses: ./
id: list-sql
with:
Expand All @@ -31,8 +37,14 @@ jobs:
if: github.event_name == 'pull_request'
name: runner / sqlfluff (github-pr-check)
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- uses: ./
id: list-sql
with:
Expand All @@ -53,8 +65,14 @@ jobs:
if: github.event_name == 'pull_request'
name: runner / sqlfluff (github-pr-review)
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python }}
- uses: ./
id: list-sql
continue-on-error: true
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@
This is a github action to lint SQL with [sqlfluff](https://github.com/sqlfluff/sqlfluff).
The action automatically leaves comments about SQL violation using [reviewdog](https://github.com/reviewdog/reviewdog)

## Requirements
We have to set up a python environment in our workflow, because `action-sqlfluff` is a composite action.
In order not to interfere our python environment, it would be nicer to set up python separattely.
I made sure the action works on python 3.8, 3.9 and 3.10.

## Input

```yaml
Expand Down Expand Up @@ -144,6 +149,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: yu-iskw/action-sqlfluff@v1
id: lint-sql
with:
Expand Down
11 changes: 4 additions & 7 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ inputs:
Default is `false`.
required: false
default: 'false'
reviewdog_flags:
description: 'Additional reviewdog flags'
reviewdog_version:
description: 'reviewdog version'
required: false
default: ''
default: 'v0.13.0'
### Flags for sqlfluff ###
sqlfluff_version:
description: 'sqlfluff version. Use the latest version if not set.'
Expand Down Expand Up @@ -125,10 +125,7 @@ runs:
steps:
- uses: reviewdog/action-setup@v1
with:
reviewdog_version: v0.13.0
- uses: actions/setup-python@v2
with:
python-version: 3.9
reviewdog_version: ${{ inputs.reviewdog_version }}
- run: $GITHUB_ACTION_PATH/script.sh
id: sqlfluff-with-reviewdog-in-composite
shell: bash
Expand Down

0 comments on commit bd5886c

Please sign in to comment.