ci: remove commit message check (#1256)

This commit is contained in:
vladopajic 2025-02-17 13:35:42 +01:00 committed by GitHub
parent be33ad6ac7
commit 79cdc31b37
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 0 additions and 123 deletions

View File

@ -1,12 +0,0 @@
#!/usr/bin/env bash
# Colors
export YLW='\033[1;33m'
export RED='\033[0;31m'
export GRN='\033[0;32m'
export BLU='\033[0;34m'
export BLD='\033[1m'
export RST='\033[0m'
# Clear line
export CLR='\033[2K'

View File

@ -1,4 +0,0 @@
#!/usr/bin/env bash
source .github/scripts/parse_commits.sh
parse_commits "$@"

View File

@ -1,30 +0,0 @@
#!/usr/bin/env bash
# The output of this script is as follows:
# 1. One line "checking commits between: <start_commit> <end_commit>"
# 2. One line for each commit message that is not well-formed
set -euo pipefail
source .github/scripts/colors.sh
parse_commits() {
BASE_BRANCH=${BASE_BRANCH:-master}
start_commit=${1:-origin/${BASE_BRANCH}}
end_commit=${2:-HEAD}
exit_code=0
echo -e "${GRN}Checking commits between:${RST} $start_commit $end_commit"
# Run the loop in the current shell using process substitution
while IFS= read -r message || [ -n "$message" ]; do
# Check if commit message follows conventional commits format
if [[ ! $message =~ ^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test)(\(.*\))?:.*$ ]]; then
echo -e "${YLW}Commit message is ill-formed:${RST} $message"
exit_code=1
fi
done < <(git log --format=%s "$start_commit".."$end_commit")
exit ${exit_code}
}

View File

@ -1,77 +0,0 @@
name: "Conventional Commits"
on:
pull_request:
types:
- opened
- edited
- reopened
- synchronize
jobs:
main:
name: Validate commit messages
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Check commit message
id: check_commit_message
if: always()
run: |
set +e
base_sha=${{ github.event.pull_request.base.sha }}
head_sha=${{ github.event.pull_request.head.sha }}
output=$(.github/scripts/commit_check.sh "${base_sha}" "${head_sha}" 2>&1)
exit_code=$?
echo "${output}" | sed '$d'
echo "exit_code=${exit_code}" >> $GITHUB_OUTPUT
invalid_commit_messages=$(echo "${output}" | sed '1d;$d')
invalid_commit_messages=$(echo "${output}" | sed '1d;$d')
invalid_commit_messages=$(echo "${invalid_commit_messages}" | sed 's/\x1b\[[0-9;]*m//g') # Remove color codes
invalid_commit_messages=$(echo "${invalid_commit_messages}" | sed 's/^Commit message is ill-formed: //') # Remove prefix
if [[ $exit_code -ne 0 ]]; then
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "error_message<<$EOF" >> "$GITHUB_ENV"
echo "${invalid_commit_messages}" >> "$GITHUB_ENV"
echo "$EOF" >> "$GITHUB_ENV"
fi
- name: "Publish failed commit messages"
uses: marocchino/sticky-pull-request-comment@v2
# When the previous steps fails, the workflow would stop. By adding this
# condition you can continue the execution with the populated error message.
if: always() && (steps.check_commit_message.outputs.exit_code != 0)
with:
header: commit-message-lint-error
message: |
Commits must follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/)
Please fix these commit messages:
```
${{ env.error_message }}
```
# Delete a previous comment when the issue has been resolved
- name: "Delete previous comment"
if: ${{ steps.check_commit_message.outputs.exit_code == 0 }}
uses: marocchino/sticky-pull-request-comment@v2
with:
header: commit-message-lint-error
delete: true
- name: "Mark as failed"
if: steps.check_commit_message.outputs.exit_code != 0
uses: actions/github-script@v7
with:
script: |
core.setFailed("Some commit messages are ill-formed")