Show git commit hash as version in Slack header
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4848253c49
commit
f1fba2dfb2
@ -1,9 +1,21 @@
|
|||||||
import json
|
import json
|
||||||
|
import subprocess
|
||||||
import requests
|
import requests
|
||||||
import config
|
import config
|
||||||
from datetime import datetime, timedelta, date
|
from datetime import datetime, timedelta, date
|
||||||
|
|
||||||
|
|
||||||
|
def _git_version() -> str:
|
||||||
|
try:
|
||||||
|
return subprocess.check_output(
|
||||||
|
["git", "rev-parse", "--short", "HEAD"],
|
||||||
|
stderr=subprocess.DEVNULL,
|
||||||
|
text=True,
|
||||||
|
).strip()
|
||||||
|
except Exception:
|
||||||
|
return "unknown"
|
||||||
|
|
||||||
|
|
||||||
ALERT_LOSS_EUR = 200 # pérdida absoluta > 200€ → alerta
|
ALERT_LOSS_EUR = 200 # pérdida absoluta > 200€ → alerta
|
||||||
ALERT_MARGIN_PCT = -50 # margen % < -50% → alerta
|
ALERT_MARGIN_PCT = -50 # margen % < -50% → alerta
|
||||||
TOP_N = 5 # campañas a mostrar en rankings
|
TOP_N = 5 # campañas a mostrar en rankings
|
||||||
@ -214,11 +226,12 @@ def build_and_send(collected: list, dry_run: bool, prev_month_metricas: dict = N
|
|||||||
|
|
||||||
# ── Construir bloques ─────────────────────────────────────────────────────
|
# ── Construir bloques ─────────────────────────────────────────────────────
|
||||||
mode = "🔵 DRY RUN" if dry_run else "⚡ PRODUCCIÓN"
|
mode = "🔵 DRY RUN" if dry_run else "⚡ PRODUCCIÓN"
|
||||||
|
version = _git_version()
|
||||||
|
|
||||||
blocks = [
|
blocks = [
|
||||||
{
|
{
|
||||||
"type": "header",
|
"type": "header",
|
||||||
"text": {"type": "plain_text", "text": f"LEADS OPTIMIZER — {now.strftime('%d/%m/%Y %H:%M')} {mode}"},
|
"text": {"type": "plain_text", "text": f"LEADS OPTIMIZER v{version} — {now.strftime('%d/%m/%Y %H:%M')} {mode}"},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"type": "section",
|
"type": "section",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user