Skip to content

Commit

Permalink
chore(tests): require BREAKING_CHANGE_REASON when using "breaking cha…
Browse files Browse the repository at this point in the history
…nge allowed" label (#5958)
  • Loading branch information
bshaffer committed Mar 24, 2023
1 parent efd9ec1 commit 3cf139d
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/backwards-compatibility-check.yaml
@@ -1,5 +1,7 @@
name: Backwards Compatibility Check
on: [pull_request]
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled, edited]
jobs:
# More info at https://github.com/Roave/BackwardCompatibilityCheck.
backwards-compatibility-check:
Expand All @@ -17,7 +19,7 @@ jobs:
- 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 JUSTIFICATION" in a comment or description
# 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
Expand All @@ -29,10 +31,26 @@ jobs:
repository: ${{ github.repository }}
- name: "Check for BC breaks (Next Release)"
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 JUSTIFICATION" in a comment or description
continue-on-error: ${{ contains(github.event.pull_request.labels.*.name, 'breaking change allowed') }}
# 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/actions-comment-pull-request@v2.3.1
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

0 comments on commit 3cf139d

Please sign in to comment.