https://github.com/gr2m/octokit-plugin-search-and-replace-pull-request
Octokit plugin to replace a term across all repository files via a pull request
https://github.com/gr2m/octokit-plugin-search-and-replace-pull-request
Last synced: about 1 year ago
JSON representation
Octokit plugin to replace a term across all repository files via a pull request
- Host: GitHub
- URL: https://github.com/gr2m/octokit-plugin-search-and-replace-pull-request
- Owner: gr2m
- License: mit
- Created: 2020-06-15T00:19:53.000Z (about 6 years ago)
- Default Branch: main
- Last Pushed: 2024-06-18T05:24:15.000Z (about 2 years ago)
- Last Synced: 2025-04-19T12:11:54.960Z (about 1 year ago)
- Language: TypeScript
- Size: 667 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# octokit-plugin-search-and-replace-pull-request
> Octokit plugin to replace a term across all repository files via a pull request
[](https://www.npmjs.com/package/octokit-plugin-search-and-replace-pull-request)
[](https://github.com/gr2m/octokit-plugin-search-and-replace-pull-request/actions?query=workflow%3ATest+branch%3Amain)
[](https://dependabot.com/)
## Usage
Browsers
Load `octokit-plugin-search-and-replace-pull-request` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [cdn.pika.dev](https://cdn.pika.dev)
```html
import { Octokit } from "https://cdn.pika.dev/@octokit/core";
import { searchAndReplacePullRequest } from "https://cdn.pika.dev/octokit-plugin-search-and-replace-pull-request";
```
Node
Install with `npm install @octokit/core octokit-plugin-search-and-replace-pull-request`. Optionally replace `@octokit/core` with a compatible module
```js
const { Octokit } = require("@octokit/core");
const {
searchAndReplacePullRequest,
} = require("octokit-plugin-search-and-replace-pull-request");
```
```js
octokit.createSearchAndReplacePullRequest({
owner: "octocat",
repo: "hello-world",
title: "pull request title",
body: "pull request description",
base: "master" /* optional: defaults to default branch */,
head: "rename-master-to-main",
terms: [
{
search: "master",
replace: "main",
},
],
});
```
One commit is created for every term. If there are no matches at all, an empty commit is created.
## Contributing
See [CONTRIBUTING.md](CONTRIBUTING.md)
## License
[MIT](LICENSE)