action runner 타입 제한, README 추가

This commit is contained in:
Lectom C Han
2025-12-16 16:18:30 +09:00
parent 777e3dac88
commit 23be76333e
3 changed files with 75 additions and 2 deletions

View File

@@ -8,11 +8,11 @@ on:
required: false
default: ''
schedule:
- cron: '0 2 * * *' # Runs every day at 2:00 AM
- cron: '7 2 * * *' # Runs every day at 2:07 AM
jobs:
mirror:
runs-on: ubuntu-latest
runs-on: [internal]
timeout-minutes: 360 # 6 hours timeout
steps:
- name: Checkout
@@ -34,6 +34,7 @@ jobs:
BASE_GITEA_USER: ${{ vars.BASE_GITEA_USER }} # The user who owns the token
INPUT_BRANCHES: ${{ github.event.inputs.branches }}
NOTIFY_WEBHOOK: ${{ vars.NOTIFY_WEBHOOK }} # Optional chat webhook
SYNC_TAGS: ${{ vars.SYNC_TAGS }} # Optional, "false" to skip tag sync
run: |
set -euo pipefail
@@ -42,6 +43,7 @@ jobs:
SOURCE_SSH_HOST="engdev@172.16.42.118"
ROOT_DIR="$(pwd)"
NOTIFY_WEBHOOK="${NOTIFY_WEBHOOK:-}"
SYNC_TAGS="${SYNC_TAGS:-true}"
notify_status() {
local status="$1" repo="$2" branch="$3" mode="$4" start_epoch="$5" extra="${6:-}"
@@ -254,6 +256,16 @@ jobs:
rm -rf "${CLONE_DIR}"
return
fi
if [[ "${SYNC_TAGS}" == "true" ]]; then
echo "Fetching tags from source..."
if ! git fetch --prune --prune-tags --no-tags source "refs/tags/*:refs/tags/*"; then
echo "::error::Failed to fetch tags from source repo"
notify_status "error" "${repo_name}" "${branch_name}" "${backup_mode}" "${start_epoch}" "tag fetch 오류"
cd "${ROOT_DIR}"
rm -rf "${CLONE_DIR}"
return
fi
fi
echo "Pushing '${branch_name}' to Gitea repository '${repo_name}'..."
if ! git push --progress --force origin "refs/heads/${branch_name}:refs/heads/main"; then
@@ -263,6 +275,13 @@ jobs:
rm -rf "${CLONE_DIR}"
return
fi
if [[ "${SYNC_TAGS}" == "true" ]]; then
echo "Pushing tags to Gitea repository '${repo_name}'..."
if ! git push --force --prune origin "refs/tags/*:refs/tags/*"; then
echo "::warning::Failed to push tags to target repository"
notify_status "error" "${repo_name}" "${branch_name}" "${backup_mode}" "${start_epoch}" "tag push 오류"
fi
fi
# Cleanup
cd "${ROOT_DIR}"