dp-zp-agent/scripts/git_runner/sync-zpwiki.yml
2026-11-06 00:18:38 +01:00

45 lines
1.4 KiB
YAML

# Template: install as .gitea/workflows/sync-zpwiki.yml on dp-zp-agent/master.
# Also copy sync_fork.sh and ssh_known_hosts to scripts/git_runner/ on that branch.
name: Denna aktualizacia zpwiki forku
"on":
push:
branches: [master]
paths:
- .gitea/workflows/sync-zpwiki.yml
- scripts/git_runner/sync_fork.sh
- scripts/git_runner/ssh_known_hosts
schedule:
- cron: "0 3 * * *"
jobs:
sync-wiki:
runs-on: zpwiki-sync
timeout-minutes: 10
steps:
- name: Pripravit Git a Bash
shell: sh
run: apk add --no-cache bash git openssh-client ca-certificates curl
- name: Synchronizovat fork s hlavnou wiki
shell: bash
env:
ZPWIKI_SYNC_SSH_KEY: ${{ secrets.ZPWIKI_SYNC_SSH_KEY }}
WORKFLOW_SHA: ${{ gitea.sha }}
run: |
set -euo pipefail
set +x
if [[ ! "$WORKFLOW_SHA" =~ ^[0-9a-fA-F]{40}$ ]]; then
echo "Chyba platna Git revizia workflow." >&2
exit 1
fi
work="$(mktemp -d)"
trap 'rm -rf "$work"' EXIT
for file in sync_fork.sh ssh_known_hosts; do
curl --fail --silent --show-error --proto '=https' \
--connect-timeout 15 --max-time 60 --retry 2 \
"https://git.kemt.fei.tuke.sk/jp170na/dp-zp-agent/raw/commit/$WORKFLOW_SHA/scripts/git_runner/$file" \
--output "$work/$file"
done
bash "$work/sync_fork.sh"