Auto-Commit 2026-03-01 06:55
This commit is contained in:
@@ -1,28 +1,53 @@
|
|||||||
param(
|
# Ein super dummes PowerShell Script.
|
||||||
[string]$RepoPath = "C:\Users\Kevkus\Desktop\Obsidian\Allgemeine D&D Notizen\DND Zeug"
|
# Für mich:
|
||||||
)
|
# Nutzung ist easy.
|
||||||
|
# Erst git init in dem Ordner
|
||||||
|
# Dann git branch -M mai
|
||||||
|
# Dann git add . und git commit -m "Nachricht!"
|
||||||
|
# Leeres(!) Gitea Repo erstellen
|
||||||
|
# git remote add origin [Link hier]
|
||||||
|
# Und dann nur noch dieses Script im Verzeichnis des Repo lokal ausführen und es pusht automatisch Änderungen hoch.
|
||||||
|
|
||||||
|
# push-updates.ps1
|
||||||
|
|
||||||
Set-StrictMode -Version Latest
|
Set-StrictMode -Version Latest
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
# Datum/Time für Commit-Message (lokal, ISO-ish)
|
Write-Host "Working in $(Get-Location)"
|
||||||
$stamp = Get-Date -Format "yyyy-MM-dd HH:mm"
|
|
||||||
|
|
||||||
Set-Location $RepoPath
|
# Prüfen ob Git-Repo
|
||||||
|
if (-not (Test-Path ".git")) {
|
||||||
|
Write-Host "Kein Git-Repository im aktuellen Ordner."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
# Add alles
|
# Optional: Pull mit Rebase
|
||||||
|
try {
|
||||||
|
git pull --rebase | Out-Null
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
Write-Host "Pull fehlgeschlagen – evtl. Konflikt. Abbruch."
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
# Änderungen hinzufügen
|
||||||
git add -A | Out-Null
|
git add -A | Out-Null
|
||||||
|
|
||||||
# Prüfen ob überhaupt Änderungen da sind
|
# Prüfen ob Änderungen existieren
|
||||||
$changes = git status --porcelain
|
$changes = git status --porcelain
|
||||||
|
|
||||||
if ([string]::IsNullOrWhiteSpace($changes)) {
|
if ([string]::IsNullOrWhiteSpace($changes)) {
|
||||||
Write-Host "Keine Änderungen – nichts zu committen/pushen."
|
Write-Host "Keine Änderungen – nichts zu committen."
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Commit + Push
|
# Commit
|
||||||
$msg = "Automatischer Push von $stamp"
|
$stamp = Get-Date -Format "yyyy-MM-dd HH:mm"
|
||||||
|
$msg = "Auto-Commit $stamp"
|
||||||
|
|
||||||
git commit -m $msg | Out-Null
|
git commit -m $msg | Out-Null
|
||||||
|
|
||||||
|
# Push
|
||||||
git push | Out-Null
|
git push | Out-Null
|
||||||
|
|
||||||
Write-Host "OK: $msg"
|
Write-Host "Push erfolgreich: $msg"
|
||||||
@@ -9,7 +9,7 @@ import random
|
|||||||
# KONFIG
|
# KONFIG
|
||||||
# -------------------------
|
# -------------------------
|
||||||
|
|
||||||
WEBHOOK_URL = "https://discord.com/api/webhooks/1440463711645990912/g__qrs1k7gpeHO9xMY0TahIYjVoA0NNTl0mGcn2us80NeTb9hly_lDI41trpuc4oumH3"
|
WEBHOOK_URL = "Discord URL"
|
||||||
BASE_URL = "https://das-schmeckt-mir.ruhr/images/pdf/speise_knapp/{kw:02d}_KW_Speiseplan{year}_Knapp.jpg"
|
BASE_URL = "https://das-schmeckt-mir.ruhr/images/pdf/speise_knapp/{kw:02d}_KW_Speiseplan{year}_Knapp.jpg"
|
||||||
|
|
||||||
SAVE_DIR = "/opt/speiseplan-bot/plans"
|
SAVE_DIR = "/opt/speiseplan-bot/plans"
|
||||||
|
|||||||
Reference in New Issue
Block a user