Skip to content

Commit

Permalink
ci(darker): use latest commit in base branch
Browse files Browse the repository at this point in the history
  • Loading branch information
p2edwards committed Dec 2, 2024
1 parent 522eb19 commit 1a5a78e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/darker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 100

- name: Set up Python
uses: actions/setup-python@v5
Expand All @@ -22,8 +22,9 @@ jobs:
# annotations with string, e.g. def my_method(my_model: 'ModelName')

# darker still exit with code 1 even with no errors on changes
- name: Run Darker with base commit
- name: Run Darker with tip of base branch
run: |
output=$(darker --check --isort -L "flake8 --max-line-length=88 --extend-ignore=F821" kpi kobo hub -r ${{ github.event.pull_request.base.sha }})
LATEST_IN_BASE_BRANCH=$(git rev-parse ${{ github.sha }}^@ | grep -Fvx ${{ github.event.pull_request.head.sha}})
output=$(darker --check --isort -L "flake8 --max-line-length=88 --extend-ignore=F821" kpi kobo hub -r $LATEST_IN_BASE_BRANCH)
[[ -n "$output" ]] && echo "$output" && exit 1 || exit 0
shell: /usr/bin/bash {0}

0 comments on commit 1a5a78e

Please sign in to comment.