Merge remote-tracking branch 'origin/development' into feature/data-export-api

This commit is contained in:
Devin Major 2026-04-23 08:58:50 -04:00
commit 40e405ac57
2 changed files with 141 additions and 0 deletions

View File

@ -0,0 +1,77 @@
# Gitea Actions Sync git repository to SVN
# Equivalent of .circleci/config.yml, translated to GitHub Actions syntax
# which Gitea Actions supports natively.
#
# Prerequisites (set as repository Secrets in Gitea → Settings → Secrets):
# SVN_USERNAME SVN commit username
# SVN_PASSWORD SVN commit password
# SVN_REPO_URL Base SVN repo URL (e.g. https://svn.example.com/repos/myproject)
name: Sync to SVN
on:
push:
branches:
- master
jobs:
push-to-svn:
runs-on: self-hosted
steps:
- name: Checkout git repository
uses: actions/checkout@v4
# SVN and rsync are pre-installed in the container image, but the
# apt-get call is kept so the workflow works on a stock runner too.
- name: Install SVN and rsync
run: |
if ! command -v svn &>/dev/null || ! command -v rsync &>/dev/null; then
sudo apt-get update -qq && sudo apt-get install -y subversion rsync
fi
- name: Verify SVN credentials are set
run: |
if [ -z "${{ secrets.SVN_USERNAME }}" ]; then echo "ERROR: SVN_USERNAME secret is not set" && exit 1; fi
if [ -z "${{ secrets.SVN_PASSWORD }}" ]; then echo "ERROR: SVN_PASSWORD secret is not set" && exit 1; fi
if [ -z "${{ secrets.SVN_REPO_URL }}" ]; then echo "ERROR: SVN_REPO_URL secret is not set" && exit 1; fi
echo "All SVN secrets are set."
- name: Checkout SVN branch
run: |
svn checkout \
--username "${{ secrets.SVN_USERNAME }}" \
--password "${{ secrets.SVN_PASSWORD }}" \
--no-auth-cache \
--non-interactive \
--trust-server-cert \
"${{ secrets.SVN_REPO_URL }}/branches/data-export-api-copy" svn-branch
- name: Sync files to SVN working copy
run: |
rsync -a --delete \
--exclude='.git/' \
--exclude='.gitea/' \
--exclude='.svn/' \
--exclude='svn-branch/' \
. svn-branch/
- name: Stage and commit to SVN
run: |
cd svn-branch
# Add all new/unversioned files and directories in one pass
svn add --force .
# Delete files removed from git (handles paths with spaces).
# '|| true' prevents pipefail aborting when grep finds no '!' lines.
svn status | grep '^!' | while IFS= read -r line; do
svn delete "${line:8}@"
done || true
# Attempt commit; svn commit exits 0 silently when nothing changed
svn commit \
--username "${{ secrets.SVN_USERNAME }}" \
--password "${{ secrets.SVN_PASSWORD }}" \
--no-auth-cache \
--non-interactive \
--trust-server-cert \
-m "Gitea CI sync from commit ${{ github.sha }} [ci skip]"

64
.githooks/pre-commit Normal file
View File

@ -0,0 +1,64 @@
#!/bin/sh
branch=$(git rev-parse --abbrev-ref HEAD)
# Allow master and development
if [ "$branch" = "master" ] || [ "$branch" = "development" ]; then
exit 0
fi
# Validate feature/* and bugfix/* branches
case "$branch" in
feature/*|bugfix/*)
name="${branch#*/}"
# Name must not be empty
if [ -z "$name" ]; then
echo "ERROR: Branch '$branch' has an empty name after the prefix."
exit 1
fi
# Only letters, digits, and dashes allowed
if echo "$name" | grep -qE '[^a-zA-Z0-9-]'; then
echo "ERROR: Branch '$branch' contains invalid characters."
echo " Only letters, digits, and dashes are allowed after the prefix."
exit 1
fi
# No leading or trailing dashes
if echo "$name" | grep -qE '^-|-$'; then
echo "ERROR: Branch '$branch' must not start or end with a dash."
exit 1
fi
# No consecutive dashes
if echo "$name" | grep -q -- '--'; then
echo "ERROR: Branch '$branch' must not contain consecutive dashes."
exit 1
fi
# Max 25 characters excluding dashes
name_no_dashes=$(echo "$name" | tr -d '-')
char_count=${#name_no_dashes}
if [ "$char_count" -gt 25 ]; then
echo "ERROR: Branch '$branch': the name after the prefix is $char_count characters (excluding dashes), max is 25."
exit 1
fi
exit 0
;;
esac
echo "ERROR: Branch name '$branch' does not follow the naming convention."
echo ""
echo " Allowed formats:"
echo " master"
echo " development"
echo " feature/{name}"
echo " bugfix/{name}"
echo ""
echo " Rules for feature/bugfix names:"
echo " - Letters, digits, and dashes only (no spaces)"
echo " - No leading, trailing, or consecutive dashes"
echo " - Max 20 characters excluding dashes"
exit 1