Skip to content

Commit 7ae0819

Browse files
authored
Merge pull request #2 from space-ros/add-action (#1)
Add reusable Action for commit message checks
2 parents 1b99b2e + 22498db commit 7ae0819

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-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: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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: Un-shallow the git history so we can poke around in it
8+
run: git fetch --unshallow
9+
shell: bash
10+
11+
- name: Check that every commit name includes an issue reference like "#1"
12+
run: |
13+
set -eo pipefail
14+
IFS=$'\n'
15+
commits=$(git log --oneline origin/${{github.base_ref}}..origin/${{github.head_ref}})
16+
for commit in $commits
17+
do
18+
if [[ $commit =~ ^.*#[0-9]+.*$ ]];
19+
then
20+
continue
21+
else
22+
echo "Found commit with no issue number: $commit"
23+
exit 1
24+
fi
25+
done
26+
shell: bash

0 commit comments

Comments
 (0)