From 0aad741ba16d12b9d7cd9c46a91d0fc700fbf409 Mon Sep 17 00:00:00 2001 From: Oliver Kopp Date: Sun, 16 Feb 2025 20:41:49 +0100 Subject: [PATCH] Rework logic --- .github/ghprcomment.yml | 2 +- .github/workflows/force-push-detection.yml | 26 ---------------------- .github/workflows/tests.yml | 18 ++++++++++++++- 3 files changed, 18 insertions(+), 28 deletions(-) delete mode 100644 .github/workflows/force-push-detection.yml diff --git a/.github/ghprcomment.yml b/.github/ghprcomment.yml index a721e37356b..9e8f5810e9c 100644 --- a/.github/ghprcomment.yml +++ b/.github/ghprcomment.yml @@ -41,7 +41,7 @@ You can then run these tests in IntelliJ to reproduce the failing tests locally. We offer a quick test running howto in the section [Final build system checks](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/intellij-12-build.html#final-build-system-checks) in our setup guide. -- jobName: detect-force-push +- jobName: no-force-push message: > Do not force-push! Force push is off limits and very bad style when working together on a project. diff --git a/.github/workflows/force-push-detection.yml b/.github/workflows/force-push-detection.yml deleted file mode 100644 index ee12eb6df79..00000000000 --- a/.github/workflows/force-push-detection.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Force Push Detection - -on: - pull_request: - types: - - synchronize - -jobs: - detect-force-push: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Check force push - id: force_push_check - run: | - MERGE_BASE=$(git merge-base ${{ github.event.before }} ${{ github.event.after }}) - if [[ "$MERGE_BASE" == "${{ github.event.before }}" ]]; then - echo "✅ Regular commit" - else - echo "❌ Force push detected" - exit 1 - fi diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index eb06d1176ca..613e8c9dece 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -52,7 +52,6 @@ jobs: - name: Run checkstyle using gradle run: ./gradlew checkstyleMain checkstyleTest checkstyleJmh - openrewrite: name: OpenRewrite runs-on: ubuntu-latest @@ -372,6 +371,23 @@ jobs: - name: Merge Conflict finder uses: olivernybroe/action-conflict-finder@v4.0 + no-force-push: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check force push + id: force_push_check + run: | + if git cat-file -e ${{ github.event.before }} 2>/dev/null; then + echo "✅ Regular push detected." + else + echo "❌ Force push detected" + fi + other_than_main: name: Source branch is other than "main" runs-on: ubuntu-latest