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,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`);
|
||||
});
|
||||
Reference in new issue
Block a user