From 1a5a78e1e2bf7c88de945a0d4890e6b62d7054d5 Mon Sep 17 00:00:00 2001 From: Phil Edwards Date: Mon, 2 Dec 2024 13:47:52 -0600 Subject: [PATCH] ci(darker): use latest commit in base branch --- .github/workflows/darker.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/darker.yml b/.github/workflows/darker.yml index d5b221d63c..80afe94239 100644 --- a/.github/workflows/darker.yml +++ b/.github/workflows/darker.yml @@ -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 @@ -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}