setting up actions
All checks were successful
Log every push / log-push (push) Successful in 1s

This commit is contained in:
Boban
2026-04-04 16:41:32 +02:00
parent d8d1b93db3
commit c7f19a8ae3
3 changed files with 52 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
name: Log every push
on:
push:
jobs:
log-push:
runs-on: windows
defaults:
run:
shell: powershell
steps:
- name: Append push info to txt log
env:
PUSHER: ${{ gitea.actor }}
REF: ${{ gitea.ref }}
REPO: ${{ gitea.repository }}
COMMITS_JSON: ${{ toJson(github.event.commits) }}
run: |
$logDir = "C:\gitea-logs"
$logFile = Join-Path $logDir "push-log.txt"
New-Item -ItemType Directory -Path $logDir -Force | Out-Null
$branch = $env:REF -replace '^refs/heads/', ''
$time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
Add-Content -Path $logFile -Value "========================================"
Add-Content -Path $logFile -Value "Time: $time"
Add-Content -Path $logFile -Value "Repo: $env:REPO"
Add-Content -Path $logFile -Value "Pusher: $env:PUSHER"
Add-Content -Path $logFile -Value "Branch: $branch"
Add-Content -Path $logFile -Value "Commits:"
$commits = $env:COMMITS_JSON | ConvertFrom-Json
foreach ($commit in $commits)
{
Add-Content -Path $logFile -Value " - SHA: $($commit.id)"
Add-Content -Path $logFile -Value " Author: $($commit.author.name) <$($commit.author.email)>"
Add-Content -Path $logFile -Value " Message: $($commit.message)"
}
Add-Content -Path $logFile -Value ""