Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add reusable Action for commit message checks #2

Merged
merged 1 commit into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/workflows/test-itself.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
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
- uses: ./
26 changes: 26 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Commit message standards checks
description: Check the integrity of commit messages against Space ROS project standards

runs:
using: composite
steps:
- name: Un-shallow the git history so we can poke around in it
run: git fetch --unshallow
shell: bash

- 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