diff --git a/.github/workflows/test-itself.yaml b/.github/workflows/test-itself.yaml new file mode 100644 index 0000000..d264f6b --- /dev/null +++ b/.github/workflows/test-itself.yaml @@ -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: ./ diff --git a/action.yaml b/action.yaml new file mode 100644 index 0000000..a490cf6 --- /dev/null +++ b/action.yaml @@ -0,0 +1,28 @@ +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: + # 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