diff --git a/.github/workflows/lint-go.yaml b/.github/workflows/lint-go.yaml index 3a1abb3..4ff186d 100644 --- a/.github/workflows/lint-go.yaml +++ b/.github/workflows/lint-go.yaml @@ -47,7 +47,11 @@ jobs: - name: Verify commit signed-off run: | set -eu -o pipefail - COMMITS=$(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}) + if [ "${{ github.event_name }}" = "pull_request" ]; then + COMMITS=$(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}) + else + COMMITS="${{ github.sha }}" + fi for commit in $COMMITS; do commit_msg=$(git log --format=%B -n 1 $commit) if ! echo "$commit_msg" | grep -qE "^Signed-off-by: .+ <.+@.+>$"; then diff --git a/.github/workflows/test-go.yaml b/.github/workflows/test-go.yaml index 7789330..0181068 100644 --- a/.github/workflows/test-go.yaml +++ b/.github/workflows/test-go.yaml @@ -34,7 +34,11 @@ jobs: - name: Build for every commit run: | set -eu -o pipefail - COMMITS=$(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}) + if [ "${{ github.event_name }}" = "pull_request" ]; then + COMMITS=$(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}) + else + COMMITS="${{ github.sha }}" + fi for commit in $COMMITS ; do git checkout $commit || exit 1 go build ./... @@ -66,7 +70,11 @@ jobs: - name: Run unit test for every commit run: | set -eu -o pipefail - COMMITS=$(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}) + if [ "${{ github.event_name }}" = "pull_request" ]; then + COMMITS=$(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}) + else + COMMITS="${{ github.sha }}" + fi for commit in $COMMITS ; do git checkout $commit || exit 1 make test @@ -98,7 +106,11 @@ jobs: - name: Run CLI tests for every commit run: | set -eu -o pipefail - COMMITS=$(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}) + if [ "${{ github.event_name }}" = "pull_request" ]; then + COMMITS=$(git rev-list ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}) + else + COMMITS="${{ github.sha }}" + fi for commit in $COMMITS ; do git checkout $commit || exit 1 make cli-test clean