Skip to content

Commit

Permalink
Add lint workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
justinchuby committed Feb 5, 2023
1 parent a701531 commit 15d72bb
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/Lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Lint

on:
push:
branches:
- main
tags:
- v*
pull_request:

jobs:
lintrunner:
name: lintrunner
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
python_version: ["3.11"]

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python_version }}
- name: Install Lintrunner
run: |
pip install .
lintrunner init
- name: Run lintrunner on all files
run: |
set +e
if ! lintrunner -v --force-color --all-files --tee-json=lint.json; then
echo ""
echo -e "\e[1m\e[36mYou can reproduce these results locally by using \`lintrunner -m main\`.\e[0m"
exit 1
fi
- name: Store annotations
continue-on-error: true
run: |
# Use jq to massage the JSON lint output into GitHub Actions workflow commands.
jq --raw-output \
'"::\(if .severity == "advice" or .severity == "disabled" then "warning" else .severity end) file=\(.path),line=\(.line),col=\(.char),title=\(.code) \(.name)::" + (.description | gsub("\\n"; "%0A"))' \
lint.json

0 comments on commit 15d72bb

Please sign in to comment.