-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reusable Action for commit message checks
- Loading branch information
1 parent
1b99b2e
commit 43e5979
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: Test this Action by running it against itself | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
run-itself: | ||
runs-on: ubuntu-24.04 | ||
name: Check its own commit messages | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- uses: ./ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Commit message standards checks | ||
description: Check the integrity of commit messages against Space ROS project standards | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@v4 | ||
with: | ||
lfs: true | ||
submodules: recursive | ||
# Don't do a shallow clone since we need to poke around in the Git history | ||
fetch-depth: 0 | ||
|
||
- name: Check that every commit name includes an issue reference like "#1" | ||
run: | | ||
set -eo pipefail | ||
IFS=$'\n' | ||
commits=$(git log --oneline origin/${{github.base_ref}}..origin/${{github.head_ref}}) | ||
for commit in $commits | ||
do | ||
if [[ $commit =~ ^.*#[0-9]+.*$ ]]; | ||
then | ||
continue | ||
else | ||
echo "Found commit with no issue number: $commit" | ||
exit 1 | ||
fi | ||
done | ||
shell: bash |