Skip to content

Commit 8b3bf07

Browse files
committed
Add workflow to trim Dependabot PR message bodies (quantumlib#1031)
1 parent cdf1025 commit 8b3bf07

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Copyright 2025 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
16+
# Remove bloat from Dependabot's PR messages
17+
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18+
19+
name: Dependabot PR trimmer
20+
run-name: Filter message body of PR ${{github.event.pull_request.number}}
21+
22+
on:
23+
pull_request:
24+
types: [opened]
25+
workflow_dispatch:
26+
inputs:
27+
pr-number:
28+
description: 'The PR number of the PR to edit:'
29+
type: string
30+
required: true
31+
32+
# Declare default permissions as read only.
33+
permissions: read-all
34+
35+
jobs:
36+
filter-message:
37+
name: Filter PR message body
38+
runs-on: ubuntu-24.04
39+
timeout-minutes: 5
40+
permissions: write-all
41+
steps:
42+
- if: >-
43+
github.event.pull_request.user.login == 'dependabot[bot]' ||
44+
github.event_name == 'workflow_dispatch'
45+
env:
46+
pr-number: ${{inputs.pr-number || github.event.pull_request.number}}
47+
run: |
48+
gh pr view ${{env.pr-number}} --json body --jq .body |\
49+
sed '/(dependabot-automerge-end)/,/<\/details>/d' |\
50+
gh pr edit ${{env.pr-number}} --body-file -

0 commit comments

Comments
 (0)