- Add scripts/validate_commit_msg.py with conventional commit enforcement - Add scripts/configure_repo.py for Gitea branch protection and labels - Add scripts/__init__.py for Python package importability - Create Gitea Actions workflows: ci, auto-merge, post-merge, publish - Update .pre-commit-config.yaml with commit-msg hook - Update pyproject.toml pythonpath and coverage for scripts - Add comprehensive unit tests for both scripts with 100% coverage
31 lines
980 B
YAML
31 lines
980 B
YAML
name: Auto-merge
|
|
|
|
on:
|
|
pull_request:
|
|
types: [labeled]
|
|
|
|
jobs:
|
|
merge:
|
|
if: github.event.label.name == 'ready-to-merge'
|
|
runs-on: docker
|
|
steps:
|
|
- name: Squash merge with task ID
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
run: |
|
|
BRANCH="${{ github.head_ref }}"
|
|
TASK_ID=$(echo "$BRANCH" | grep -oE 'GRM-[0-9]+' || echo "")
|
|
if [ -z "$TASK_ID" ]; then
|
|
echo "ERROR: No task ID (GRM-N) found in branch name '$BRANCH'"
|
|
exit 1
|
|
fi
|
|
|
|
PR_TITLE="${{ github.event.pull_request.title }}"
|
|
MERGE_TITLE="${TASK_ID}: ${PR_TITLE}"
|
|
|
|
curl -X POST \
|
|
"https://git.oblachno.oblachno.fyi/api/v1/repos/${{ github.repository }}/pulls/${{ github.event.number }}/merge" \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"Do\": \"squash\", \"MergeTitleField\": \"${MERGE_TITLE}\"}"
|