Repository navigation
47 lines (41 loc) · 1.59 KB
/
Copy pathbreaking-changes.yml
File metadata and controls
47 lines (41 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# SPDX-FileCopyrightText: 2026 Igor Santos
# SPDX-License-Identifier: Apache-2.0
#
# A reminder for breaking changes (ADR 0037). The pull request title and body
# become the squash commit, and the release notes list a commit marked
# breaking first, with the text of its BREAKING CHANGE footer. When the title
# has `!` after the type or scope and the body has no such footer, this job
# warns. It does not fail the pull request.
name: breaking-changes
on:
pull_request:
types: [opened, edited, synchronize, reopened]
permissions: {}
concurrency:
group: breaking-changes-${{ github.ref }}
cancel-in-progress: true
jobs:
footer:
name: footer
runs-on: ubuntu-latest
timeout-minutes: 5
permissions: {}
steps:
- uses: step-security/harden-runner@46b06cea07f9e64621fdf066ba77ac6915163d43 # v2.22.3
with:
egress-policy: block
- name: A breaking pull request says what breaks
env:
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
run: |
set -euo pipefail
if ! grep -Eq '^[a-z]+(\([^)]*\))?!: ' <<<"$PR_TITLE"; then
echo "The title is not marked breaking."
exit 0
fi
if grep -Eq '^BREAKING[ -]CHANGE: +[^[:space:]]' <<<"$PR_BODY"; then
echo "The body has a BREAKING CHANGE footer."
exit 0
fi
echo "::warning title=breaking-changes::the title is marked breaking. Add a line 'BREAKING CHANGE: <what breaks and what to do>' at the end of the body, so the release notes show it."