Skip to content

Commit 0ad20b2

Browse files
committed
feat(ci): Check rule version increment
1 parent 4dabdf7 commit 0ad20b2

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

.github/workflows/master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ jobs:
247247
with:
248248
name: "fibratus-amd64.msi"
249249
path: .
250-
- name: Install MSI
250+
- name: Install Fibratus
251251
shell: bash
252252
run: |
253253
./make.bat install

.github/workflows/pr.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,12 +224,14 @@ jobs:
224224
steps:
225225
- name: Checkout
226226
uses: actions/checkout@v4
227+
with:
228+
fetch-depth: 2
227229
- name: Download MSI
228230
uses: actions/download-artifact@v4
229231
with:
230232
name: "fibratus-amd64.msi"
231233
path: .
232-
- name: Install MSI
234+
- name: Install Fibratus
233235
shell: bash
234236
run: |
235237
./make.bat install
@@ -239,3 +241,25 @@ jobs:
239241
export PATH="/c/Program Files/Fibratus/Bin:$PATH"
240242
fibratus rules list
241243
fibratus rules validate
244+
- name: Get changed rules
245+
id: changed-rules
246+
uses: tj-actions/changed-files@v45
247+
with:
248+
files: |
249+
rules/**.yml
250+
- name: Check version increment
251+
if: steps.changed-rules.outputs.any_changed == 'true'
252+
env:
253+
CHANGED_RULES: ${{ steps.changed-rules.outputs.all_changed_files }}
254+
shell: bash
255+
run: |
256+
choco install yq -y
257+
for rule in ${CHANGED_RULES}; do
258+
RULE="${rule//\\//}"
259+
HEAD_VERSION=$(git show HEAD~1:$RULE | yq '.version')
260+
CURR_VERSION=$(yq '.version' $rule)
261+
if [[ "$HEAD_VERSION" == "$CURR_VERSION" ]]; then
262+
echo "$(basename $rule) changed but the version is not incremented. HEAD version: $HEAD_VERSION"
263+
exit 1
264+
fi
265+
done

0 commit comments

Comments
 (0)