Skip to content

Commit 7e4c2f8

Browse files
committed
Add reusable Action for commit message checks (#1)
1 parent 1b99b2e commit 7e4c2f8

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

.github/workflows/test-itself.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Test this Action by running it against itself
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
run-itself:
8+
runs-on: ubuntu-24.04
9+
name: Check its own commit messages
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: ./

action.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Commit message standards checks
2+
description: Check the integrity of commit messages against Space ROS project standards
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Checkout source
8+
uses: actions/checkout@v4
9+
with:
10+
# Don't do a shallow clone since we need to poke around in the Git history
11+
fetch-depth: 0
12+
13+
- name: Check that every commit name includes an issue reference like "#1"
14+
run: |
15+
set -eo pipefail
16+
IFS=$'\n'
17+
commits=$(git log --oneline origin/${{github.base_ref}}..origin/${{github.head_ref}})
18+
for commit in $commits
19+
do
20+
if [[ $commit =~ ^.*#[0-9]+.*$ ]];
21+
then
22+
continue
23+
else
24+
echo "Found commit with no issue number: $commit"
25+
exit 1
26+
fi
27+
done
28+
shell: bash

0 commit comments

Comments
 (0)