From 4d6c3c1e4cad85585d0fd7dcd3d64128c8b16b27 Mon Sep 17 00:00:00 2001 From: Jan Bessai Date: Wed, 4 Feb 2026 19:28:14 +0100 Subject: [PATCH] Simplify logic to check for main in CI --- .github/workflows/test_and_release.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test_and_release.yml b/.github/workflows/test_and_release.yml index daa2085e..01fe690f 100644 --- a/.github/workflows/test_and_release.yml +++ b/.github/workflows/test_and_release.yml @@ -8,27 +8,19 @@ jobs: needs: [ ] steps: - uses: actions/checkout@v4.2.2 - - name: Check if we are head of main - id: check_head_of_main - run: | - git fetch origin main && - MAIN=`git rev-parse origin/main` && - echo "head_of_main=$MAIN" >> $GITHUB_OUTPUT && - CURRENT=`git rev-list -n 1 ${{ github.ref }} || echo "NOT_MAIN"` && - echo "current_job_ref=$CURRENT" >> $GITHUB_OUTPUT - name: Set up JDK - if: steps.check_head_of_main.outputs.head_of_main == steps.check_head_of_main.outputs.current_job_ref + if: github.ref == 'refs/heads/main' uses: actions/setup-java@v4 with: distribution: temurin java-version: 21 - name: Set up SBT - if: steps.check_head_of_master.outputs.head_of_main == steps.check_head_of_main.outputs.current_job_ref + if: github.ref == 'refs/heads/main' uses: sbt/setup-sbt@v1.1.16 with: sbt-runner-version: 1.10.11 - name: Build and release - if: steps.check_head_of_master.outputs.head_of_main == steps.check_head_of_main.outputs.current_job_ref + if: github.ref == 'refs/heads/main' env: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}