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 ""