-
Notifications
You must be signed in to change notification settings - Fork 2.1k
67 lines (57 loc) · 1.88 KB
/
breaking_changes_detector.yml
File metadata and controls
67 lines (57 loc) · 1.88 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: "Detect breaking changes"
on:
pull_request:
branches:
- main
jobs:
check-semver:
name: Check semver
runs-on: ubuntu-latest
outputs:
logs: ${{ steps.check_semver.outputs.logs }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install cargo-semver-checks
run: cargo install cargo-semver-checks
- name: Run cargo-semver-checks
id: check_semver
run: |
set +e
cargo semver-checks --baseline-rev origin/main 2>&1 | tee /tmp/semver-output.txt
EXIT_CODE=${PIPESTATUS[0]}
OUTPUT=$(sed 's/\x1b\[[0-9;]*m//g' /tmp/semver-output.txt)
echo "logs<<EOF" >> "$GITHUB_OUTPUT"
echo "$OUTPUT" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
exit $EXIT_CODE
comment-on-pr:
name: Comment on pull request
runs-on: ubuntu-latest
needs: check-semver
if: always()
permissions:
pull-requests: write
steps:
- name: Comment
if: ${{ needs.check-semver.result != 'success' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-semver-check-error
message: |
Thank you for opening this pull request!
Reviewer note: [cargo-semver-checks](https://github.com/obi1kenobi/cargo-semver-checks) reported the current version number is not SemVer-compatible with the changes made since the last release.
Details:
```
${{ needs.check-semver.outputs.logs }}
```
- name: Delete comment
if: ${{ needs.check-semver.result == 'success' }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: pr-semver-check-error
delete: true