Skripte plattformunabhängig in Node.js statt Bash
This commit is contained in:
1 parent
7e64f85836
commit
712acdf2e5
12 files changed
+273
-172
No files matched your search
@@ -0,0 +1,21 @@
|
||||
// Stoppt das lokale Forgejo. Mit --purge werden Container, Daten-Volume, Token und Git-Remote gelöscht.
|
||||
import fs from "node:fs";
|
||||
import {
|
||||
STATE_DIR, FORGEJO_CONTAINER, FORGEJO_VOLUME, GIT_REMOTE, log, run, containerEngine, main,
|
||||
} from "./lib.mjs";
|
||||
|
||||
main(async () => {
|
||||
const engine = containerEngine();
|
||||
const quiet = { capture: true, allowFail: true };
|
||||
|
||||
run(engine, ["stop", FORGEJO_CONTAINER], quiet);
|
||||
if (process.argv.includes("--purge")) {
|
||||
run(engine, ["rm", "-f", FORGEJO_CONTAINER], quiet);
|
||||
run(engine, ["volume", "rm", "-f", FORGEJO_VOLUME], quiet);
|
||||
fs.rmSync(STATE_DIR, { recursive: true, force: true });
|
||||
run("git", ["remote", "remove", GIT_REMOTE], quiet);
|
||||
log("Forgejo inkl. Daten entfernt");
|
||||
} else {
|
||||
log("Forgejo gestoppt (Daten bleiben erhalten; --purge zum Löschen)");
|
||||
}
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Stoppt das lokale Forgejo. Mit --purge werden Container, Daten-Volume und Token gelöscht.
|
||||
source "$(dirname "$0")/lib.sh"
|
||||
|
||||
podman stop "$FORGEJO_CONTAINER" >/dev/null 2>&1 || true
|
||||
if [[ "${1:-}" == "--purge" ]]; then
|
||||
podman rm -f "$FORGEJO_CONTAINER" >/dev/null 2>&1 || true
|
||||
podman volume rm -f "$FORGEJO_VOLUME" >/dev/null 2>&1 || true
|
||||
rm -rf "$STATE_DIR"
|
||||
git -C "$ROOT_DIR" remote remove "$GIT_REMOTE" 2>/dev/null || true
|
||||
log "Forgejo inkl. Daten entfernt"
|
||||
else
|
||||
log "Forgejo gestoppt (Daten bleiben erhalten; --purge zum Löschen)"
|
||||
fi
|
||||
@@ -0,0 +1,92 @@
|
||||
// Startet ein lokales Forgejo (Git-Server) in Podman/Docker, legt Bot-User, Token und
|
||||
// Repository an und pusht den aktuellen Stand des lokalen Repos dorthin.
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import {
|
||||
STATE_DIR, FORGEJO_IMAGE, FORGEJO_CONTAINER, FORGEJO_VOLUME, FORGEJO_PORT, FORGEJO_URL,
|
||||
FORGEJO_USER, FORGEJO_PASSWORD, FORGEJO_REPO, GIT_REMOTE, log, run, containerEngine, main,
|
||||
} from "./lib.mjs";
|
||||
|
||||
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
|
||||
|
||||
async function healthy() {
|
||||
try {
|
||||
return (await fetch(`${FORGEJO_URL}/api/healthz`)).ok;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export async function forgejoUp() {
|
||||
fs.mkdirSync(STATE_DIR, { recursive: true });
|
||||
const engine = containerEngine();
|
||||
|
||||
const exists = !run(engine, ["container", "inspect", FORGEJO_CONTAINER], { capture: true, allowFail: true }).status;
|
||||
if (!exists) {
|
||||
log(`Starte Forgejo (${FORGEJO_IMAGE}) auf ${FORGEJO_URL} via ${engine}`);
|
||||
run(engine, [
|
||||
"run", "-d", "--name", FORGEJO_CONTAINER,
|
||||
"-p", `${FORGEJO_PORT}:3000`,
|
||||
"-v", `${FORGEJO_VOLUME}:/data`,
|
||||
"-e", "USER_UID=1000", "-e", "USER_GID=1000",
|
||||
"-e", "FORGEJO__security__INSTALL_LOCK=true",
|
||||
"-e", `FORGEJO__server__ROOT_URL=${FORGEJO_URL}/`,
|
||||
"-e", "FORGEJO__server__HTTP_PORT=3000",
|
||||
"-e", "FORGEJO__database__DB_TYPE=sqlite3",
|
||||
"-e", "FORGEJO__service__DISABLE_REGISTRATION=true",
|
||||
"-e", "FORGEJO__repository__DEFAULT_BRANCH=main",
|
||||
FORGEJO_IMAGE,
|
||||
], { capture: true });
|
||||
} else {
|
||||
run(engine, ["start", FORGEJO_CONTAINER], { capture: true });
|
||||
}
|
||||
|
||||
log("Warte auf Forgejo …");
|
||||
for (let i = 0; i < 60 && !(await healthy()); i++) await sleep(1000);
|
||||
if (!(await healthy())) throw new Error(`Forgejo unter ${FORGEJO_URL} nicht erreichbar`);
|
||||
|
||||
const forgejoCli = (...args) =>
|
||||
run(engine, ["exec", "-u", "git", FORGEJO_CONTAINER, "forgejo", ...args], { capture: true }).stdout;
|
||||
|
||||
const users = forgejoCli("admin", "user", "list").split("\n").map((l) => l.trim().split(/\s+/)[1]);
|
||||
if (!users.includes(FORGEJO_USER)) {
|
||||
log(`Lege Admin-/Bot-User '${FORGEJO_USER}' an`);
|
||||
forgejoCli("admin", "user", "create", "--admin", "--username", FORGEJO_USER,
|
||||
"--password", FORGEJO_PASSWORD, "--email", "renovate@localhost", "--must-change-password=false");
|
||||
}
|
||||
|
||||
const tokenFile = path.join(STATE_DIR, "token");
|
||||
if (!fs.existsSync(tokenFile) || !fs.readFileSync(tokenFile, "utf8").trim()) {
|
||||
log("Erzeuge Access-Token");
|
||||
const token = forgejoCli("admin", "user", "generate-access-token", "--username", FORGEJO_USER,
|
||||
"--token-name", `renovate-${Date.now()}`, "--scopes", "all", "--raw").trim();
|
||||
fs.writeFileSync(tokenFile, token);
|
||||
}
|
||||
const token = fs.readFileSync(tokenFile, "utf8").trim();
|
||||
const headers = { Authorization: `token ${token}`, "Content-Type": "application/json" };
|
||||
|
||||
const repoRes = await fetch(`${FORGEJO_URL}/api/v1/repos/${FORGEJO_USER}/${FORGEJO_REPO}`, { headers });
|
||||
if (repoRes.status === 401) throw new Error(`Token ungültig – ${tokenFile} löschen und erneut starten`);
|
||||
if (!repoRes.ok) {
|
||||
log(`Lege Repository ${FORGEJO_USER}/${FORGEJO_REPO} an`);
|
||||
const res = await fetch(`${FORGEJO_URL}/api/v1/user/repos`, {
|
||||
method: "POST",
|
||||
headers,
|
||||
body: JSON.stringify({ name: FORGEJO_REPO, default_branch: "main", private: false }),
|
||||
});
|
||||
if (!res.ok) throw new Error(`Repository anlegen fehlgeschlagen: ${res.status} ${await res.text()}`);
|
||||
}
|
||||
|
||||
const remoteUrl = `http://${FORGEJO_USER}:${token}@localhost:${FORGEJO_PORT}/${FORGEJO_USER}/${FORGEJO_REPO}.git`;
|
||||
const hasRemote = !run("git", ["remote", "get-url", GIT_REMOTE], { capture: true, allowFail: true }).status;
|
||||
run("git", ["remote", hasRemote ? "set-url" : "add", GIT_REMOTE, remoteUrl]);
|
||||
|
||||
log("Pushe lokalen Branch 'main' nach Forgejo");
|
||||
run("git", ["push", "-q", GIT_REMOTE, "main:main"]);
|
||||
|
||||
log(`Forgejo läuft: ${FORGEJO_URL} (Login: ${FORGEJO_USER} / ${FORGEJO_PASSWORD})`);
|
||||
return token;
|
||||
}
|
||||
|
||||
if (import.meta.url === pathToFileURL(process.argv[1]).href) main(forgejoUp);
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Startet ein lokales Forgejo (Git-Server) in Podman/Docker, legt Bot-User, Token und
|
||||
# Repository an und pusht den aktuellen Stand des lokalen Repos dorthin.
|
||||
source "$(dirname "$0")/lib.sh"
|
||||
cd "$ROOT_DIR"
|
||||
mkdir -p "$STATE_DIR"
|
||||
|
||||
if ! podman container exists "$FORGEJO_CONTAINER"; then
|
||||
log "Starte Forgejo ($FORGEJO_IMAGE) auf $FORGEJO_URL"
|
||||
podman run -d --name "$FORGEJO_CONTAINER" \
|
||||
-p "${FORGEJO_PORT}:3000" \
|
||||
-v "${FORGEJO_VOLUME}:/data" \
|
||||
-e USER_UID=1000 -e USER_GID=1000 \
|
||||
-e FORGEJO__security__INSTALL_LOCK=true \
|
||||
-e FORGEJO__server__ROOT_URL="$FORGEJO_URL/" \
|
||||
-e FORGEJO__server__HTTP_PORT=3000 \
|
||||
-e FORGEJO__database__DB_TYPE=sqlite3 \
|
||||
-e FORGEJO__service__DISABLE_REGISTRATION=true \
|
||||
-e FORGEJO__repository__DEFAULT_BRANCH=main \
|
||||
"$FORGEJO_IMAGE" >/dev/null
|
||||
else
|
||||
podman start "$FORGEJO_CONTAINER" >/dev/null
|
||||
fi
|
||||
|
||||
log "Warte auf Forgejo …"
|
||||
for _ in $(seq 1 60); do
|
||||
curl -fs "$FORGEJO_URL/api/healthz" >/dev/null 2>&1 && break
|
||||
sleep 1
|
||||
done
|
||||
curl -fs "$FORGEJO_URL/api/healthz" >/dev/null || { echo "Forgejo nicht erreichbar"; exit 1; }
|
||||
|
||||
forgejo_cli() { podman exec -u git "$FORGEJO_CONTAINER" forgejo "$@"; }
|
||||
|
||||
if ! forgejo_cli admin user list | awk '{print $2}' | grep -qx "$FORGEJO_USER"; then
|
||||
log "Lege Admin-/Bot-User '$FORGEJO_USER' an"
|
||||
forgejo_cli admin user create --admin --username "$FORGEJO_USER" \
|
||||
--password "$FORGEJO_PASSWORD" --email "renovate@localhost" --must-change-password=false >/dev/null
|
||||
fi
|
||||
|
||||
if [[ ! -s "$STATE_DIR/token" ]]; then
|
||||
log "Erzeuge Access-Token"
|
||||
forgejo_cli admin user generate-access-token --username "$FORGEJO_USER" \
|
||||
--token-name "renovate-$(date +%s)" --scopes all --raw > "$STATE_DIR/token"
|
||||
fi
|
||||
TOKEN="$(cat "$STATE_DIR/token")"
|
||||
|
||||
if ! curl -fs -H "Authorization: token $TOKEN" "$FORGEJO_URL/api/v1/repos/$FORGEJO_USER/$FORGEJO_REPO" >/dev/null; then
|
||||
log "Lege Repository $FORGEJO_USER/$FORGEJO_REPO an"
|
||||
curl -fs -X POST -H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
|
||||
-d "{\"name\":\"$FORGEJO_REPO\",\"default_branch\":\"main\",\"private\":false}" \
|
||||
"$FORGEJO_URL/api/v1/user/repos" >/dev/null
|
||||
fi
|
||||
|
||||
REMOTE_URL="http://${FORGEJO_USER}:${TOKEN}@localhost:${FORGEJO_PORT}/${FORGEJO_USER}/${FORGEJO_REPO}.git"
|
||||
if git remote get-url "$GIT_REMOTE" >/dev/null 2>&1; then
|
||||
git remote set-url "$GIT_REMOTE" "$REMOTE_URL"
|
||||
else
|
||||
git remote add "$GIT_REMOTE" "$REMOTE_URL"
|
||||
fi
|
||||
|
||||
log "Pushe lokalen Branch 'main' nach Forgejo"
|
||||
git push -q "$GIT_REMOTE" main:main
|
||||
|
||||
log "Forgejo läuft: $FORGEJO_URL (Login: $FORGEJO_USER / $FORGEJO_PASSWORD)"
|
||||
@@ -0,0 +1,69 @@
|
||||
// Gemeinsame Einstellungen und Helfer für die Renovate-Skripte (plattformunabhängig: Windows/Linux/macOS).
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import path from "node:path";
|
||||
|
||||
const env = process.env;
|
||||
|
||||
export const ROOT_DIR = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
||||
export const STATE_DIR = path.join(ROOT_DIR, ".renovate-local");
|
||||
|
||||
export const RENOVATE_VERSION = env.RENOVATE_VERSION ?? "44.149.3";
|
||||
|
||||
export const FORGEJO_IMAGE = env.FORGEJO_IMAGE ?? "codeberg.org/forgejo/forgejo:11";
|
||||
export const FORGEJO_CONTAINER = env.FORGEJO_CONTAINER ?? "renovate-forgejo";
|
||||
export const FORGEJO_VOLUME = env.FORGEJO_VOLUME ?? "renovate-forgejo-data";
|
||||
export const FORGEJO_PORT = env.FORGEJO_PORT ?? "3000";
|
||||
export const FORGEJO_URL = `http://localhost:${FORGEJO_PORT}`;
|
||||
export const FORGEJO_USER = env.FORGEJO_USER ?? "renovate";
|
||||
export const FORGEJO_PASSWORD = env.FORGEJO_PASSWORD ?? "renovate-local-123";
|
||||
export const FORGEJO_REPO = env.FORGEJO_REPO ?? "monorepo";
|
||||
export const GIT_REMOTE = env.GIT_REMOTE ?? "forgejo";
|
||||
|
||||
const isWindows = process.platform === "win32";
|
||||
|
||||
export function log(msg) {
|
||||
console.log(`\x1b[1;34m==>\x1b[0m ${msg}`);
|
||||
}
|
||||
|
||||
/** Führt einen Befehl aus. Bricht bei Fehler ab, außer `allowFail` ist gesetzt. */
|
||||
export function run(cmd, args, { capture = false, allowFail = false, extraEnv = {} } = {}) {
|
||||
const res = spawnSync(cmd, args, {
|
||||
cwd: ROOT_DIR,
|
||||
stdio: capture ? ["ignore", "pipe", "pipe"] : "inherit",
|
||||
encoding: "utf8",
|
||||
env: { ...env, ...extraEnv },
|
||||
// npx/npm sind unter Windows .cmd-Dateien und brauchen eine Shell
|
||||
shell: isWindows && (cmd === "npx" || cmd === "npm"),
|
||||
});
|
||||
if (res.error) {
|
||||
if (allowFail) return res;
|
||||
throw new Error(`'${cmd}' konnte nicht gestartet werden: ${res.error.message}`);
|
||||
}
|
||||
if (res.status !== 0 && !allowFail) {
|
||||
if (capture) process.stderr.write(res.stderr ?? "");
|
||||
throw new Error(`'${cmd} ${args.join(" ")}' endete mit Exit-Code ${res.status}`);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
export function renovateCli(args, extraEnv = {}) {
|
||||
return run("npx", ["--yes", `renovate@${RENOVATE_VERSION}`, ...args], { extraEnv });
|
||||
}
|
||||
|
||||
/** Podman bevorzugen, sonst Docker (CONTAINER_ENGINE=docker erzwingt Docker). */
|
||||
export function containerEngine() {
|
||||
const candidates = env.CONTAINER_ENGINE ? [env.CONTAINER_ENGINE] : ["podman", "docker"];
|
||||
for (const c of candidates) {
|
||||
if (!run(c, ["--version"], { capture: true, allowFail: true }).error) return c;
|
||||
}
|
||||
throw new Error("Weder podman noch docker gefunden – wird für Forgejo benötigt.");
|
||||
}
|
||||
|
||||
/** Startet ein Skript-main() mit sauberer Fehlerausgabe. */
|
||||
export function main(fn) {
|
||||
fn().catch((err) => {
|
||||
console.error(`\x1b[1;31mFehler:\x1b[0m ${err.message}`);
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
# Gemeinsame Einstellungen für die Renovate-Skripte (wird per "source" eingebunden).
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
STATE_DIR="$ROOT_DIR/.renovate-local"
|
||||
|
||||
RENOVATE_VERSION="${RENOVATE_VERSION:-44.149.3}"
|
||||
|
||||
FORGEJO_IMAGE="${FORGEJO_IMAGE:-codeberg.org/forgejo/forgejo:11}"
|
||||
FORGEJO_CONTAINER="${FORGEJO_CONTAINER:-renovate-forgejo}"
|
||||
FORGEJO_VOLUME="${FORGEJO_VOLUME:-renovate-forgejo-data}"
|
||||
FORGEJO_PORT="${FORGEJO_PORT:-3000}"
|
||||
FORGEJO_URL="http://localhost:${FORGEJO_PORT}"
|
||||
FORGEJO_USER="${FORGEJO_USER:-renovate}"
|
||||
FORGEJO_PASSWORD="${FORGEJO_PASSWORD:-renovate-local-123}"
|
||||
FORGEJO_REPO="${FORGEJO_REPO:-monorepo}"
|
||||
GIT_REMOTE="${GIT_REMOTE:-forgejo}"
|
||||
|
||||
renovate_cli() {
|
||||
npx --yes "renovate@${RENOVATE_VERSION}" "$@"
|
||||
}
|
||||
|
||||
log() { printf '\033[1;34m==>\033[0m %s\n' "$*"; }
|
||||
@@ -0,0 +1,28 @@
|
||||
// Nur prüfen: Renovate läuft mit --platform=local direkt auf diesem Verzeichnis.
|
||||
// Es werden keine Dateien geändert; das Ergebnis (gefundene Updates) landet im Log
|
||||
// und als JSON-Report in .renovate-local/report.json.
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import { ROOT_DIR, STATE_DIR, RENOVATE_VERSION, log, renovateCli, main } from "./lib.mjs";
|
||||
|
||||
main(async () => {
|
||||
fs.mkdirSync(STATE_DIR, { recursive: true });
|
||||
const reportPath = path.join(STATE_DIR, "report.json");
|
||||
|
||||
log(`Renovate ${RENOVATE_VERSION} – Dry-Run (lookup) auf ${ROOT_DIR}`);
|
||||
renovateCli(
|
||||
["--platform=local", "--dry-run=lookup", "--report-type=file", `--report-path=${reportPath}`],
|
||||
{ LOG_LEVEL: process.env.LOG_LEVEL ?? "info" },
|
||||
);
|
||||
|
||||
log("Gefundene Updates:");
|
||||
const report = JSON.parse(fs.readFileSync(reportPath, "utf8"));
|
||||
for (const repo of Object.values(report.repositories)) {
|
||||
for (const [manager, files] of Object.entries(repo.packageFiles)) {
|
||||
for (const f of files)
|
||||
for (const d of f.deps)
|
||||
for (const u of d.updates ?? [])
|
||||
console.log(` [${manager}] ${f.packageFile}: ${d.depName} ${d.currentValue} -> ${u.newValue} (${u.updateType})`);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,24 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Nur prüfen: Renovate läuft mit --platform=local direkt auf diesem Verzeichnis.
|
||||
# Es werden keine Dateien geändert; das Ergebnis (gefundene Updates) landet im Log
|
||||
# und als JSON-Report in .renovate-local/report.json.
|
||||
source "$(dirname "$0")/lib.sh"
|
||||
cd "$ROOT_DIR"
|
||||
mkdir -p "$STATE_DIR"
|
||||
|
||||
log "Renovate ${RENOVATE_VERSION} – Dry-Run (lookup) auf $ROOT_DIR"
|
||||
LOG_LEVEL="${LOG_LEVEL:-info}" renovate_cli \
|
||||
--platform=local \
|
||||
--dry-run=lookup \
|
||||
--report-type=file \
|
||||
--report-path="$STATE_DIR/report.json"
|
||||
|
||||
log "Gefundene Updates:"
|
||||
node -e '
|
||||
const r = require(process.argv[1]);
|
||||
for (const [repo, data] of Object.entries(r.repositories)) {
|
||||
for (const [manager, files] of Object.entries(data.packageFiles)) {
|
||||
for (const f of files) for (const d of f.deps) for (const u of d.updates ?? [])
|
||||
console.log(` [${manager}] ${f.packageFile}: ${d.depName} ${d.currentValue} -> ${u.newValue} (${u.updateType})`);
|
||||
}
|
||||
}' "$STATE_DIR/report.json"
|
||||
@@ -0,0 +1,41 @@
|
||||
// Vollständiger Renovate-Lauf, komplett lokal:
|
||||
// 1. lokales Forgejo starten + aktuellen Stand pushen (forgejo-up.mjs)
|
||||
// 2. Renovate-CLI gegen das lokale Forgejo laufen lassen (Branches + PRs + Dependency Dashboard)
|
||||
// 3. die Renovate-Branches zurück ins lokale Repo holen (forgejo/renovate/*)
|
||||
import path from "node:path";
|
||||
import { forgejoUp } from "./forgejo-up.mjs";
|
||||
import {
|
||||
ROOT_DIR, STATE_DIR, RENOVATE_VERSION, FORGEJO_URL, FORGEJO_USER, FORGEJO_REPO, GIT_REMOTE,
|
||||
log, run, renovateCli, main,
|
||||
} from "./lib.mjs";
|
||||
|
||||
main(async () => {
|
||||
const token = await forgejoUp();
|
||||
|
||||
const extraEnv = {
|
||||
RENOVATE_CONFIG_FILE: path.join(ROOT_DIR, "renovate", "config.js"),
|
||||
RENOVATE_ENDPOINT: `${FORGEJO_URL}/api/v1`,
|
||||
RENOVATE_TOKEN: token,
|
||||
RENOVATE_BASE_DIR: path.join(STATE_DIR, "renovate-cache"),
|
||||
LOG_LEVEL: process.env.LOG_LEVEL ?? "info",
|
||||
};
|
||||
// Optional: GitHub-Token (nur lesend) für Release Notes/Changelogs in den PRs
|
||||
if (process.env.GITHUB_TOKEN && !process.env.RENOVATE_GITHUB_COM_TOKEN) {
|
||||
extraEnv.RENOVATE_GITHUB_COM_TOKEN = process.env.GITHUB_TOKEN;
|
||||
}
|
||||
|
||||
log(`Starte Renovate ${RENOVATE_VERSION} gegen ${FORGEJO_URL} (${FORGEJO_USER}/${FORGEJO_REPO})`);
|
||||
renovateCli([`${FORGEJO_USER}/${FORGEJO_REPO}`, ...process.argv.slice(2)], extraEnv);
|
||||
|
||||
log("Hole Renovate-Branches ins lokale Repo");
|
||||
run("git", ["fetch", "-q", "--prune", GIT_REMOTE, `+refs/heads/*:refs/remotes/${GIT_REMOTE}/*`]);
|
||||
const branches = run("git", ["branch", "-r", "--list", `${GIT_REMOTE}/renovate/*`], { capture: true }).stdout;
|
||||
process.stdout.write(branches.replace(/^(?=.)/gm, " "));
|
||||
|
||||
console.log(`
|
||||
Fertig. Nächste Schritte:
|
||||
- PRs ansehen: ${FORGEJO_URL}/${FORGEJO_USER}/${FORGEJO_REPO}/pulls
|
||||
- Änderungen ansehen: git diff main...${GIT_REMOTE}/renovate/<branch>
|
||||
- lokal übernehmen: git merge ${GIT_REMOTE}/renovate/<branch>
|
||||
- oder PR in Forgejo mergen und dann: git pull ${GIT_REMOTE} main`);
|
||||
});
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# Vollständiger Renovate-Lauf, komplett lokal:
|
||||
# 1. lokales Forgejo starten + aktuellen Stand pushen (forgejo-up.sh)
|
||||
# 2. Renovate-CLI gegen das lokale Forgejo laufen lassen (Branches + PRs + Dependency Dashboard)
|
||||
# 3. die Renovate-Branches zurück ins lokale Repo holen (forgejo/renovate/*)
|
||||
source "$(dirname "$0")/lib.sh"
|
||||
cd "$ROOT_DIR"
|
||||
|
||||
bash "$ROOT_DIR/scripts/forgejo-up.sh"
|
||||
TOKEN="$(cat "$STATE_DIR/token")"
|
||||
|
||||
# Optional: GitHub-Token (nur lesend) für Release Notes/Changelogs in den PRs
|
||||
if [[ -n "${GITHUB_TOKEN:-}" && -z "${RENOVATE_GITHUB_COM_TOKEN:-}" ]]; then
|
||||
export RENOVATE_GITHUB_COM_TOKEN="$GITHUB_TOKEN"
|
||||
fi
|
||||
|
||||
log "Starte Renovate ${RENOVATE_VERSION} gegen $FORGEJO_URL ($FORGEJO_USER/$FORGEJO_REPO)"
|
||||
RENOVATE_CONFIG_FILE="$ROOT_DIR/renovate/config.js" \
|
||||
RENOVATE_ENDPOINT="$FORGEJO_URL/api/v1" \
|
||||
RENOVATE_TOKEN="$TOKEN" \
|
||||
RENOVATE_BASE_DIR="$STATE_DIR/renovate-cache" \
|
||||
LOG_LEVEL="${LOG_LEVEL:-info}" \
|
||||
renovate_cli "$FORGEJO_USER/$FORGEJO_REPO" "$@"
|
||||
|
||||
log "Hole Renovate-Branches ins lokale Repo"
|
||||
git fetch -q --prune "$GIT_REMOTE" '+refs/heads/*:refs/remotes/'"$GIT_REMOTE"'/*'
|
||||
git branch -r --list "$GIT_REMOTE/renovate/*" | sed 's/^/ /'
|
||||
|
||||
cat <<INFO
|
||||
|
||||
Fertig. Nächste Schritte:
|
||||
- PRs ansehen: $FORGEJO_URL/$FORGEJO_USER/$FORGEJO_REPO/pulls
|
||||
- Änderungen ansehen: git diff main...$GIT_REMOTE/renovate/<branch>
|
||||
- lokal übernehmen: git merge $GIT_REMOTE/renovate/<branch>
|
||||
- oder PR in Forgejo mergen und dann: git pull $GIT_REMOTE main
|
||||
INFO
|
||||
Reference in new issue
Block a user