Fix test regressions #277
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Fail on Malformed Commits in PR Branch | |
| # brazenly copied from ArduPilot's test_branch_conventions.yml | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| contents: read | |
| jobs: | |
| check-merge-commits: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout PR branch | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| fetch-depth: 0 | |
| - name: Fetch base branch | |
| run: | | |
| git remote -v | |
| git remote add upstream ${{ github.event.pull_request.base.repo.clone_url }} | |
| git fetch upstream ${{ github.base_ref }} | |
| git show upstream/${{ github.base_ref }} | |
| - name: Check for merge commits in PR branch | |
| run: | | |
| # Find merge-base between base branch and (rebased) PR branch | |
| echo "Merge target is origin/${{ github.base_ref }}" | |
| echo "github.event.pull_request.base.ref=${{ github.event.pull_request.base.ref }} " | |
| # Look for merge commits in PR branch only | |
| MERGE_COMMITS=$(git log upstream/${{ github.base_ref }}..HEAD --merges --oneline) | |
| echo "Merge commits:" | |
| echo "$MERGE_COMMITS" | |
| if [[ -n "$MERGE_COMMITS" ]]; then | |
| echo "❌ Merge commits detected in the PR branch (not allowed):" | |
| echo "Please see https://github.com/ArduPilot/MethodicConfigurator/blob/master/CONTRIBUTING.md" | |
| exit 1 | |
| else | |
| echo "✅ No merge commits found in the PR branch." | |
| fi | |
| # Look for fixup! commits in PR branch only | |
| COMMITS=$(git log upstream/${{ github.base_ref }}..HEAD --oneline) | |
| echo "Commits:" | |
| echo "$COMMITS" | |
| if [[ "$COMMITS" == *"fixup!"* ]]; then | |
| echo "❌ fixup commits detected in the PR branch (not allowed):" | |
| echo "$COMMITS" | |
| echo "Please see https://github.com/ArduPilot/MethodicConfigurator/blob/master/CONTRIBUTING.md" | |
| exit 1 | |
| else | |
| echo "✅ No fixup commits found in the PR branch." | |
| fi |