mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-14 08:17:13 +03:00
Replace python checks with jq in workflow
Also makes sure that pushes to main ARE checked
This commit is contained in:
parent
525f0b05e7
commit
d58d831ebe
20
.github/workflows/push-checks.yml
vendored
20
.github/workflows/push-checks.yml
vendored
@ -9,7 +9,7 @@ name: Push-Checks
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ develop ]
|
branches: [ main ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -27,27 +27,15 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install flake8 pytest
|
pip install flake8 pytest wheel
|
||||||
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
if [ -f requirements-dev.txt ]; then pip install -r requirements-dev.txt; fi
|
||||||
- name: Lint with flake8
|
- name: Lint with flake8
|
||||||
env:
|
env:
|
||||||
ROOT_SHA: ${{github.base_ref}}
|
ROOT_SHA: ${{github.base_ref}}
|
||||||
|
|
||||||
run: |
|
run: |
|
||||||
DATA=$(python3 <<EOF
|
DATA=$(jq --raw-output .before $GITHUB_EVENT_PATH)
|
||||||
import json
|
|
||||||
import os
|
|
||||||
with open(os.getenv('GITHUB_EVENT_PATH')) as f:
|
|
||||||
data = json.load(f)
|
|
||||||
|
|
||||||
typ = os.getenv('GITHUB_EVENT_NAME')
|
|
||||||
|
|
||||||
if 'pull_request' in typ:
|
|
||||||
print(data['base']['ref'])
|
|
||||||
elif 'push' in typ:
|
|
||||||
print(data['before'])
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
# stop the build if there are Python syntax errors or undefined names, ignore existing
|
# stop the build if there are Python syntax errors or undefined names, ignore existing
|
||||||
git diff "$DATA" | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --diff
|
git diff "$DATA" | flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --diff
|
||||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||||
|
Loading…
x
Reference in New Issue
Block a user