0
0
mirror of https://github.com/yanhao98/renovate-example.git synced 2026-02-04 18:30:34 +08:00
Files
renovate-example/test-regex/run.mjs
严浩 ba224d5483 H (#228)
* chore(workflow): run weekly via schedule

* Add checkout step to workflow configuration

* Disable custom managers and commit body in default.json5

Commented out custom managers and commit body settings.
2025-12-10 23:47:31 +08:00

28 lines
787 B
JavaScript

// bun --bun test-regex/run.mjs
import * as path from "node:path";
import { fileURLToPath } from "node:url";
import fs from "node:fs";
const __dirname = path.dirname(fileURLToPath(import.meta.url));
function extractMatchResult(regex, text) {
const pattern = new RegExp(regex);
const match = text.match(pattern);
console.log("match", match);
return match;
}
const filecontent = fs.readFileSync(path.join(__dirname, "file.txt"), "utf8");
(() => {
const regex = "# renovate: datasource=(?<datasource>\\S+) depName=(?<depName>\\S+):(?<currentValue>\\S+)@(?<currentDigest>\\S+)";
extractMatchResult(regex, filecontent);
})();
(() => {
const regex = "^\\.github/workflows/[^/]+\\.ya?ml$";
extractMatchResult(regex, ".github/workflows/中 | 文 : 文件名.yaml");
})();