const octokit = new Octokit({ auth: "your-github-token" });
await findAndReplaceInGithubFile({
octokit,
owner: "username",
repo: "repository",
path: "path/to/file.txt",
regex: /findMe/g,
replacement: "replaceWithMe",
commitMessage: "Replaced 'findMe' with 'replaceWithMe'"
});
Will throw an error if any GitHub API request fails (except for 404 errors, which only log a warning).
Generated using TypeDoc
Finds and replaces text in a file hosted on a GitHub repository.