From 6defb81baf9725ad4f76a3a1dfc2b1b81d3a3f1a Mon Sep 17 00:00:00 2001 From: James Bradlee Date: Mon, 1 Apr 2024 10:40:44 +0200 Subject: [PATCH] Update quality-assurance.yaml workflow to get number of commits in push Signed-off-by: James Bradlee --- .github/workflows/quality-assurance.yaml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/quality-assurance.yaml b/.github/workflows/quality-assurance.yaml index 34a6113..8a6640b 100644 --- a/.github/workflows/quality-assurance.yaml +++ b/.github/workflows/quality-assurance.yaml @@ -20,8 +20,17 @@ jobs: lint: runs-on: ubuntu-latest steps: - - name: Checkout + - name: Get number of commits in push + id: payload + if: github.event_name == 'push' + env: + COMMITS: ${{ toJson(github.event.commits) }} + run: | + echo "commit_length=$(echo $COMMITS | jq '. | length')" >> $GITHUB_OUTPUT + - name: Checking out ${{ steps.payload.outputs.commit_length || '1' }} commits uses: actions/checkout@v4 + with: + fetch-depth: ${{ steps.payload.outputs.commit_length || '1' }} - name: Setup Ktlint uses: ./.github/actions/setup-ktlint - run: |