Skip to content

CI: Add workflow to enforce rebase before merge #4

CI: Add workflow to enforce rebase before merge

CI: Add workflow to enforce rebase before merge #4

Workflow file for this run

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:

Check failure on line 14 in .github/workflows/force-rebase.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/force-rebase.yml

Invalid workflow file

You have an error in your yaml syntax on line 14
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}" ]