Skip to content

Commit

Permalink
Add reusable Action for commit message checks
Browse files Browse the repository at this point in the history
  • Loading branch information
EzraBrooks committed Sep 5, 2024
1 parent 1b99b2e commit 43e5979
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/test-itself.yaml
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: ./
30 changes: 30 additions & 0 deletions action.yaml
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

0 comments on commit 43e5979

Please sign in to comment.