Skip to content

Commit eab38d4

Browse files
committed
Trigger on auto_merge_enabled
The trimming needs to be performed before the PR is merged so that the commit message is based on the trimmed version. This prevents us from using events such as the PR getting closed or merged. Triggering on merge queue events is also problematic, because a merge_queue event doesn't have the equivalent of "pull_request.user" and we need that to test if the PR came from Dependabot. So instead, this workflow triggers when auto-merge is enabled for the PR.
1 parent f3a1d02 commit eab38d4

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/dependabot-pr-trimmer.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,23 @@
1313
# limitations under the License.
1414

1515
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16-
# Remove bloat from Dependabot's PR messages
16+
# Trim parts of the Dependabot PR text that are unnecessary in the git history.
17+
#
18+
# The trimming needs to be performed before the PR is merged so that the commit
19+
# message is based on the trimmed version. This prevents us from using events
20+
# such as the PR getting closed or merged. Triggering on merge queue events is
21+
# also problematic, because a merge_queue event doesn't have the equivalent of
22+
# "pull_request.user" and we need that to test if the PR came from Dependabot.
23+
# So instead, this workflow triggers when auto-merge is enabled for the PR.
1724
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1825

1926
name: Dependabot PR trimmer
2027
run-name: Filter message body of PR ${{github.event.pull_request.number}}
2128

2229
on:
23-
merge_group:
30+
pull_request:
2431
types:
25-
- checks_requested
32+
- auto_merge_enabled
2633

2734
workflow_dispatch:
2835
inputs:

0 commit comments

Comments
 (0)