From 722a313cc10d7f4cf83161ba1f373e3565d699f2 Mon Sep 17 00:00:00 2001 From: MicroDev <70126934+MicroDev1@users.noreply.github.com> Date: Sat, 7 Jan 2023 21:12:39 +0530 Subject: [PATCH] set base and head commit only when the event is a pr --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6694a045be..e2c5de08a7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -136,12 +136,14 @@ jobs: EXCLUDE_COMMIT: ${{ github.event.after }} run: python3 -u ci_changes_per_commit.py - name: Set base sha + if: github.event_name == 'pull_request' run: | DEEPEN=$((DEPTH - $(git rev-list HEAD --count))) && if((DEEPEN > 0)); then git fetch --no-tags --recurse-submodules=no --deepen=$DEEPEN; fi echo "BASE_SHA=$(git rev-list $GITHUB_SHA --skip=$((DEPTH + 1)) --max-count=1)" >> $GITHUB_ENV env: DEPTH: ${{ steps.get-last-commit-with-checks.outputs.commit_depth || github.event.pull_request.commits }} - name: Set head sha + if: github.event_name == 'pull_request' run: echo "HEAD_SHA=$(git rev-list $GITHUB_SHA --skip=1 --max-count=1)" >> $GITHUB_ENV - name: Get changes id: get-changes