Skip to content

Commit 764bd20

Browse files
geraldbarre-workleapGérald Barré
andauthored
Detect breaking changes (#46)
* Detect breaking changes * wip --------- Co-authored-by: Gérald Barré <gerald.barre@gsoft.com>
1 parent 8eaa2c2 commit 764bd20

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: No breaking changes
2+
3+
on:
4+
pull_request:
5+
branches: ["main"]
6+
paths: [".workleap.rules.yaml"]
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
check-no-removed-rules:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Get base branch rules
18+
run: |
19+
git fetch origin ${{ github.base_ref }}
20+
git show origin/${{ github.base_ref }}:.workleap.rules.yaml > /tmp/base-rules.yaml
21+
22+
- name: Check for removed rules
23+
shell: pwsh
24+
run: |
25+
Install-Module -Name powershell-yaml -Force -Scope CurrentUser
26+
27+
$baseRules = (Get-Content /tmp/base-rules.yaml -Raw | ConvertFrom-Yaml).rules.Keys
28+
$currentRules = (Get-Content .workleap.rules.yaml -Raw | ConvertFrom-Yaml).rules.Keys
29+
30+
$removed = $baseRules | Where-Object { $_ -notin $currentRules }
31+
32+
if ($removed) {
33+
Write-Error "The following rules were removed, which is a breaking change:`n$($removed -join "`n")"
34+
exit 1
35+
}
36+
37+
Write-Host "No rules were removed."

0 commit comments

Comments
 (0)