Napraw wykonywanie hooka po pushu

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
2026-09-18 19:36:29 +02:00
co-authored by Copilot
parent cd617f7b14
commit 249392de03
2 changed files with 13 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
#!/bin/sh
set -e
repo_root=$(git rev-parse --show-toplevel)
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$repo_root/deploy-cloudflare.ps1"
+8 -3
View File
@@ -1,14 +1,19 @@
$ErrorActionPreference = "Stop" $ErrorActionPreference = "Stop"
$root = Split-Path -Parent $MyInvocation.MyCommand.Path $root = Split-Path -Parent $MyInvocation.MyCommand.Path
$hooks = Join-Path $root ".git\hooks" $hooks = Join-Path $root ".git\hooks"
$source = Join-Path $root "hooks\post-push.cmd" $source = Join-Path $root "hooks\post-push"
$target = Join-Path $hooks "post-push.cmd" $target = Join-Path $hooks "post-push"
if (-not (Test-Path $hooks)) { if (-not (Test-Path $hooks)) {
throw "Nie znaleziono folderu .git/hooks. Uruchom skrypt w katalogu repozytorium." throw "Nie znaleziono folderu .git/hooks. Uruchom skrypt w katalogu repozytorium."
} }
Copy-Item $source $target -Force Copy-Item $source $target -Force
Remove-Item (Join-Path $hooks "post-push") -Force -ErrorAction SilentlyContinue Remove-Item (Join-Path $hooks "post-push.cmd") -Force -ErrorAction SilentlyContinue
$bash = "C:\Program Files\Git\bin\bash.exe"
if (Test-Path $bash) {
& $bash -lc "chmod +x '$($target -replace '\\','/')'"
}
Write-Host "Zainstalowano hook post-push: $target" Write-Host "Zainstalowano hook post-push: $target"
Write-Host "Po kazdym udanym git push zostanie uruchomiony deploy do Cloudflare Pages." Write-Host "Po kazdym udanym git push zostanie uruchomiony deploy do Cloudflare Pages."