Skip to content

Commit a425917

Browse files
committed
Make auto-merge more conservative
Only do auto-merges when the pull-request contains exactly one commit. This prevents pull-requests which are manually amended from being merged automatically.
1 parent 1662ec5 commit a425917

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

.github/workflows/auto-merge.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,17 @@ permissions:
88
jobs:
99
auto-merge:
1010
runs-on: ubuntu-latest
11-
if: github.event.pull_request.user.login == 'dependabot[bot]' && github.repository == 'lycheeverse/lychee'
11+
if: |
12+
github.repository == 'lycheeverse/lychee' &&
13+
github.event.pull_request.user.login == 'dependabot[bot]'
1214
steps:
15+
- name: Commits are by Dependabot only
16+
run: |
17+
authors=$(gh pr view "$PR_URL" --json commits --jq '.commits[].authors[].login' | uniq)
18+
if [[ "$authors" != "dependabot[bot]" ]]; then
19+
echo PR seems to have been manually modified. Skipping auto merge!
20+
exit 0
21+
fi
1322
- name: Enable auto-merge for Dependabot PRs
1423
# Merge all updates as long as they pass CI
1524
run: gh pr merge --auto --merge "$PR_URL"

0 commit comments

Comments
 (0)