diff --git a/.github/workflows/force-rebase.yml b/.github/workflows/force-rebase.yml new file mode 100644 index 000000000..5c15de0ae --- /dev/null +++ b/.github/workflows/force-rebase.yml @@ -0,0 +1,21 @@ +name: Force rebased + +on: [pull_request] + +jobs: + force-rebase: + runs-on: ubuntu-latest + steps: + - name: 'PR commits + 1' + run: echo "PR_FETCH_DEPTH=$(( ${{ github.event.pull_request.commits }} + 1 ))" >> "${GITHUB_ENV}" + + - name: 'Checkout PR branch and all PR commits' + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: ${{ env.PR_FETCH_DEPTH }} + + - name: Is Rebased on master? + run: | + merges="\$(git log --oneline HEAD^${{ env.PR_FETCH_DEPTH }}...HEAD --merges )"; \ + echo "--- Merges ---\\n\${merges}"; [ -z "\${merges}" ] \ No newline at end of file