Skip to content

Commit d2a5c4f

Browse files
committed
added: Add workflow to verify that all commits in a PR are signed
1 parent 08d3f5c commit d2a5c4f

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

.husky/pre-commit

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#!/usr/bin/env sh
22
. "$(dirname "$0")/_/husky.sh"
33

4+
# Check for changelog files in staged changes
5+
./scripts/check-changelog.sh
6+
47
npx lint-staged

changelogs/2025-10-23-055245.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
type: Added
2+
issues: []
3+
description: Add workflow to verify that all commits in a PR are signed
4+
public: true
5+
tags:
6+
- None

scripts/check-changelog.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
3+
# Check if there are any new changelog files in the staged changes
4+
# This script ensures that each commit includes at least one new changelog file
5+
6+
# Get list of staged files
7+
staged_files=$(git diff --cached --name-only)
8+
9+
# Check if any staged files are in the changelogs directory
10+
changelog_files=$(echo "$staged_files" | grep "^changelogs/" || true)
11+
12+
if [ -z "$changelog_files" ]; then
13+
echo "❌ Error: No changelog files found in staged changes."
14+
echo " Please add at least one new changelog file to your commit."
15+
echo " Changelog files should be placed in the 'changelogs/' directory."
16+
echo ""
17+
echo " Example:"
18+
echo " git add changelogs/$(date +%Y-%m-%d-%H%M%S).yml"
19+
exit 1
20+
fi
21+
22+
# Count the number of changelog files
23+
changelog_count=$(echo "$changelog_files" | wc -l | tr -d ' ')
24+
25+
echo "✅ Found $changelog_count changelog file(s) in staged changes:"
26+
echo "$changelog_files" | sed 's/^/ /'
27+
28+
exit 0

0 commit comments

Comments
 (0)