Octokit plugin to create a pull request with multiple file changes
null
has changed!Previously the following snippet was causing a file deletion.
files: {
"file/to/delete.txt": null
}
If you want to retain this behavior you must use the DELETE_FILE Symbol
import { createPullRequest, DELETE_FILE } from 'octokit-plugin-create-pull-request';
files: {
"file/to/delete.txt": DELETE_FILE
}
If you want to trigger a file deletion from an update function, you can now do so by returning the deleteFile Symbol.
import { createPullRequest, DELETE_FILE } from 'octokit-plugin-create-pull-request';
files: {
"file/to/delete.txt": ({ exists, encoding, content }) => {
const fileContent = Buffer.from(content, encoding).toString("utf-8")
if (fileContent.includes('abc')) {
// trigger file deletion
return DELETE_FILE
}
// do not alter file content
return null;
}
}