From ced5f2e5e7faf370a4f2b632281cb421162fb7ec Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Tue, 4 Jan 2022 11:18:55 +0200 Subject: [PATCH] Revert "Add check-rebased Github action (#2002)" This reverts commit 2104330d4c8573e7258bf5efc142ae6595da23a7. This check doesn't work well for community pull requests, since third-party users aren't motivated to rebase pull requests to branch head after they are created. This check is useful for private repositories though. --- .github/workflows/check-rebased.sh | 26 -------------------------- .github/workflows/check-rebased.yml | 17 ----------------- 2 files changed, 43 deletions(-) delete mode 100755 .github/workflows/check-rebased.sh delete mode 100644 .github/workflows/check-rebased.yml diff --git a/.github/workflows/check-rebased.sh b/.github/workflows/check-rebased.sh deleted file mode 100755 index 2c69bcda5..000000000 --- a/.github/workflows/check-rebased.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash -set -x -e -u - -git fetch origin "$GITHUB_BASE_REF" - -BASE_ID=$(git rev-parse --verify "origin/$GITHUB_BASE_REF") -CURRENT_ID=$(git rev-parse --verify "HEAD") - -# Oldest commit that's not in the base branch -FIRST_BRANCH_ID=$(git rev-list "origin/$GITHUB_BASE_REF..HEAD" | tail -n 1) - -# Common ancestor (usually just parent of $FIRST_BRANCH_ID) -# Command will return error 1 if not found anything. So we || true to proceed. -FORK_POINT_ID=$(git merge-base "$FIRST_BRANCH_ID" "origin/$GITHUB_BASE_REF") || true - -if [[ -z "$FORK_POINT_ID" ]] -then - echo "Current branch is not forked from its base branch origin/$GITHUB_BASE_REF" - exit 1 -fi - -if [[ "$BASE_ID" != "$FORK_POINT_ID" ]] -then - echo "Current branch (at $CURRENT_ID) forked at $FORK_POINT_ID is not $BASE_ID (which is the latest \"$GITHUB_BASE_REF\")" - exit 1 -fi diff --git a/.github/workflows/check-rebased.yml b/.github/workflows/check-rebased.yml deleted file mode 100644 index d88bf3a55..000000000 --- a/.github/workflows/check-rebased.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: check-rebased -on: - pull_request: - types: [ synchronize, opened, reopened, edited ] # +edited (for triggering on PR base change) - push: - branches: [ main ] -jobs: - hook: - name: Check whether current branch is based on its base branch - runs-on: ubuntu-latest - steps: - - name: Check out repo @ current branch - uses: actions/checkout@v2 - with: - fetch-depth: 1000 # Hopefully current branch is less than 1000 commits from main - - name: Run check-rebased.sh - run: .github/workflows/check-rebased.sh