-
Notifications
You must be signed in to change notification settings - Fork 438
56 lines (56 loc) · 2.65 KB
/
backwards-compatibility-check.yaml
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
48
49
50
51
52
53
54
55
56
name: Backwards Compatibility Check
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled, edited]
jobs:
# More info at https://github.com/Roave/BackwardCompatibilityCheck.
backwards-compatibility-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: "Install PHP"
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
- name: "Install dependencies"
run: composer global require "roave/backward-compatibility-check:^8.2"
- name: "Check for BC breaks"
if: github.actor != 'release-please[bot]'
# Ensure the build still passes by adding the 'breaking change allowed' label to the PR.
# NOTE: PR should contain a BREAKING_CHANGE_REASON=[reason] in the description.
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'breaking change allowed') }}
run: |
~/.composer/vendor/bin/roave-backward-compatibility-check --from=origin/main --format=github-actions
- name: Get Latest Release
if: github.actor == 'release-please[bot]'
id: latest-release
uses: pozetroninc/github-action-get-latest-release@master
with:
repository: ${{ github.repository }}
- name: "Check for BC breaks (Next Release)"
if: github.actor == 'release-please[bot]'
# We've already approved and justified the breaking changes. Run the check but continue on error
continue-on-error: true
run: |
~/.composer/vendor/bin/roave-backward-compatibility-check \
--from=${{ steps.latest-release.outputs.release }} \
--to=origin/main --format=github-actions
# Verify that if the "breaking change allowed" label exists, so does a BREAKING_CHANGE_REASON in
# the description of the PR. Comment and exit 1 if not.
- name: "Allow breaking change: Comment"
if: |
contains(github.event.pull_request.labels.*.name, 'breaking change allowed')
&& !contains(github.event.pull_request.body, 'BREAKING_CHANGE_REASON=')
uses: thollander/[email protected]
with:
message: |
To skip the breaking change detector, the PR must contain a `BREAKING_CHANGE_REASON=[reason]`
in the PR description.
comment_tag: breaking_change_justification
- name: "Allow breaking change: Fail the build"
if: |
contains(github.event.pull_request.labels.*.name, 'breaking change allowed')
&& !contains(github.event.pull_request.body, 'BREAKING_CHANGE_REASON=')
run: exit 1