{"_id":"@adrian.insua/octokit-plugin-create-pull-request","_rev":"2-5915ce558e408b0f0fa629fc09113edc","name":"@adrian.insua/octokit-plugin-create-pull-request","dist-tags":{"latest":"1.1.2"},"versions":{"1.1.0":{"name":"@adrian.insua/octokit-plugin-create-pull-request","description":"Octokit plugin to create a pull request with multiple file changes","version":"1.1.0","license":"MIT","pika":true,"sideEffects":false,"keywords":["github","octokit","plugin","pull-request"],"repository":{"type":"git","url":"git+https://github.com/adrianiy/octokit-plugin-create-pull-request.git"},"dependencies":{"@octokit/types":"^8.0.0"},"devDependencies":{"@octokit/core":"^4.1.0","@octokit/plugin-paginate-rest":"^5.0.1","@pika/pack":"^0.5.0","@pika/plugin-build-node":"^0.9.2","@pika/plugin-build-web":"^0.9.2","@pika/plugin-ts-standard-pkg":"^0.9.2","@types/jest":"^29.2.0","@types/node":"^14.14.25","jest":"^29.0.0","prettier":"^2.7.1","semantic-release":"^19.0.3","semantic-release-plugin-update-version-in-files":"^1.1.0","ts-jest":"^29.0.3","typescript":"^4.8.4"},"publishConfig":{"access":"public"},"source":"dist-src/index.js","types":"dist-types/index.d.ts","main":"dist-node/index.js","module":"dist-web/index.js","gitHead":"8bdecff779ea68640557242c5edef50dbc1d70ee","bugs":{"url":"https://github.com/adrianiy/octokit-plugin-create-pull-request/issues"},"homepage":"https://github.com/adrianiy/octokit-plugin-create-pull-request#readme","_id":"@adrian.insua/octokit-plugin-create-pull-request@1.1.0","_nodeVersion":"18.14.2","_npmVersion":"8.19.2","dist":{"integrity":"sha512-dI+W+ZBEffBgbIaCSMu4WcOCjlIf5KDLEbhAUqUeMmjrUqlNGDxbHRBquDNrBNKry2IeJceaBDxHN+NBfdRAIA==","shasum":"853c5fb4e337b2f4a6b295e6d5b6c6c64d332cad","tarball":"https://registry.npmjs.org/@adrian.insua/octokit-plugin-create-pull-request/-/octokit-plugin-create-pull-request-1.1.0.tgz","fileCount":21,"unpackedSize":150043,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEMCIF5vsscRr3ti0doftR9x3zVtj4mQXeJxV2QORev+9N5rAh9qvEZDN9/m2KjA2zwbtbUEJGAFwhxo0sRYAxfTml34"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkAcTWACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpkbA/7BUfkKH7eaX/mYg9v3v7eK3/++kViN0Y5r/D5vsXpWiaHgkK7\r\nBPtADNd1C9SCy7NdNlPtqBBPBOVQauj0IdNwPUWVx6pzYYL8jYq0EaVkrCfQ\r\nP6KutnmMUD3RF51uWcG///RLfi1U7wsIKq8bHwyWtxpSb0o8DFj9Cn1UY4ru\r\nTNfRGWhjsdglzfOYMMy8tfLDQOlS5Won2c34+WyCKgVw9kLRCbjd4sA2ZcVe\r\npfkGZBgs5h4+LAlA9Wb8+PM/Jl3s01VKX+SC4Wiw7oDSbAsQbLff46zOqlfb\r\nd40ECcRi7IiA+vzNRKSE1SUI7nvawkU1AJEDSlUncQKr2UBFGfEhFVpdS04z\r\nCdZ/7iWcS9qCe9Yq15urH+AeKI40UAOrZeSJm2Ndx3kbcJWfnYDoD2II8Vbw\r\n9+9AXHDsOa8BsBsCjoAIH+vcYp5+enfnldxuCJR4PnVLYf49gFdOhs9PqmQD\r\n/V0BQG3iUw152b+pNWfSFBWty1ZPkNOAgNkAyQ0Uz+2Qa9ndLgvPfm+hZtw6\r\nmqYSgERZo3j9zps2odeCR8rDA/Ed5pyvB4QySQao5Kn6jGeu70ADyPyh4aPL\r\n1MZ4Yn8g5D9P0i7ftuKqed0xX/cZyBaxSjGChGVBUMEVWqSlipNcwPIPv56k\r\neSHZDem9h1ScJ7kzbklYi5O57kBzKeWm/eU=\r\n=SLB2\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"adrian.insua","email":"adrianiy@ext.inditex.com"},"directories":{},"maintainers":[{"name":"adrian.insua","email":"adrianiy@ext.inditex.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/octokit-plugin-create-pull-request_1.1.0_1677837526367_0.6707308485243986"},"_hasShrinkwrap":false},"1.1.1":{"name":"@adrian.insua/octokit-plugin-create-pull-request","description":"Octokit plugin to create a pull request with multiple file changes","version":"1.1.1","license":"MIT","pika":true,"sideEffects":false,"keywords":["github","octokit","plugin","pull-request"],"repository":{"type":"git","url":"git+https://github.com/adrianiy/octokit-plugin-create-pull-request.git"},"dependencies":{"@octokit/types":"^8.0.0"},"devDependencies":{"@octokit/core":"^4.1.0","@octokit/plugin-paginate-rest":"^5.0.1","@pika/pack":"^0.5.0","@pika/plugin-build-node":"^0.9.2","@pika/plugin-build-web":"^0.9.2","@pika/plugin-ts-standard-pkg":"^0.9.2","@types/jest":"^29.2.0","@types/node":"^14.14.25","jest":"^29.0.0","prettier":"^2.7.1","semantic-release":"^19.0.3","semantic-release-plugin-update-version-in-files":"^1.1.0","ts-jest":"^29.0.3","typescript":"^4.8.4"},"publishConfig":{"access":"public"},"source":"dist-src/index.js","types":"dist-types/index.d.ts","main":"dist-node/index.js","module":"dist-web/index.js","gitHead":"2ffbd890f1a205b038b96846d206a7a5ff28146f","bugs":{"url":"https://github.com/adrianiy/octokit-plugin-create-pull-request/issues"},"homepage":"https://github.com/adrianiy/octokit-plugin-create-pull-request#readme","_id":"@adrian.insua/octokit-plugin-create-pull-request@1.1.1","_nodeVersion":"18.14.2","_npmVersion":"8.19.2","dist":{"integrity":"sha512-Q8HkOOprwky6eYKGm0nVaUB3MTFG+l+FIquGEvKk93iqCup0M+4EFAMOV4HR2UnJJcdoj7JFw+D0ZqZJoqFUkA==","shasum":"53f867f85708a19a90509afb620cc254dc9d0bfc","tarball":"https://registry.npmjs.org/@adrian.insua/octokit-plugin-create-pull-request/-/octokit-plugin-create-pull-request-1.1.1.tgz","fileCount":21,"unpackedSize":150792,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD0FW2ClPZr+ViLrwEEKPPA9Sz44QiwtbAnI2VbNvb/wAIhAJw840CQUtpreYJFcAawKiOiYRo/pOgOCMcjps/iR/hV"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkAdVDACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoIFg/+LWOQmjSlez/VRDg+0Hbx2xxp9yaiFDFmsy9kqwS8lcsiPVRg\r\ng9Pbl0AEupkIF1ON+av5ly/39ezKPRZZb763rxWgIU/5i1ox8o+H9Nug6rZN\r\n7chwMAIVVvydye21bbBR3GvHcazTMGP3WjxCTyqvu88bntbiPMt5Rv3d1haS\r\nj0CZ6DZpwq4Yos2ZrLBNcyFVr44qpkcQslmnQ6/ZYSSVunY0/lkp8lfvgMT3\r\nbP2SprNZgGZYFPoZxmXpTweETLeHQemady/wdJNr4icn/HxnIUdz8OeGRFzI\r\n7RlVRLwHibOKTQpgNGWWOvxpNjY3F8fQURq6okHFO5omhaXHtRsGkIQdgZUN\r\nuALgTyjWJ39lpjg06/+xR7eXS6E724FI0TdnegStXNd/PyqIBOf5kpxwAKjC\r\nEiw2o4kysbmmvaLnNYN65u4vK8er8QHWXZitY/mv+caLmhN/xMWkFtXgGVVF\r\nWRB/7YCL/p5qRDQRRh0OLUXiM6d/BFqOiP5iEvg+621duo/ViPjT6oV+/Olg\r\nmbo7BEU7trdkiyHcRIyxu93f7j7gmNVqMbH0NkQuXT2e0EHf2MSPmTlCSrME\r\nxkDvemCco7hK6TSg/lYA2t4KDziDDTqTg8rO2c8jgj9UVHMeh22KfJtWy/Pm\r\nsIyXe0soSeGVsmyCCnh2S3EbffOsEQeQBwE=\r\n=CHYZ\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"adrian.insua","email":"adrianiy@ext.inditex.com"},"directories":{},"maintainers":[{"name":"adrian.insua","email":"adrianiy@ext.inditex.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/octokit-plugin-create-pull-request_1.1.1_1677841730762_0.001690674216229704"},"_hasShrinkwrap":false},"1.1.2":{"name":"@adrian.insua/octokit-plugin-create-pull-request","description":"Octokit plugin to create a pull request with multiple file changes","version":"1.1.2","license":"MIT","pika":true,"sideEffects":false,"keywords":["github","octokit","plugin","pull-request"],"repository":{"type":"git","url":"git+https://github.com/adrianiy/octokit-plugin-create-pull-request.git"},"dependencies":{"@octokit/types":"^8.0.0"},"devDependencies":{"@octokit/core":"^4.1.0","@octokit/plugin-paginate-rest":"^5.0.1","@pika/pack":"^0.5.0","@pika/plugin-build-node":"^0.9.2","@pika/plugin-build-web":"^0.9.2","@pika/plugin-ts-standard-pkg":"^0.9.2","@types/jest":"^29.2.0","@types/node":"^14.14.25","jest":"^29.0.0","prettier":"^2.7.1","semantic-release":"^19.0.3","semantic-release-plugin-update-version-in-files":"^1.1.0","ts-jest":"^29.0.3","typescript":"^4.8.4"},"publishConfig":{"access":"public"},"source":"dist-src/index.js","types":"dist-types/index.d.ts","main":"dist-node/index.js","module":"dist-web/index.js","gitHead":"ddf424a90e38982a2d9433112daca3e63e3e2a55","bugs":{"url":"https://github.com/adrianiy/octokit-plugin-create-pull-request/issues"},"homepage":"https://github.com/adrianiy/octokit-plugin-create-pull-request#readme","_id":"@adrian.insua/octokit-plugin-create-pull-request@1.1.2","_nodeVersion":"18.14.2","_npmVersion":"8.19.2","dist":{"integrity":"sha512-PGZUXE866jg3e1gWH1gOIEF409beFeEANLsjduzvLoDZPXPSkZaB0SQ1g/Z3mc2A1n5ZDxiNDRE2PLNdJ5GrTg==","shasum":"6d5f60145307ac18874d1b124a86dc2f6e8877f2","tarball":"https://registry.npmjs.org/@adrian.insua/octokit-plugin-create-pull-request/-/octokit-plugin-create-pull-request-1.1.2.tgz","fileCount":21,"unpackedSize":151008,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCID/EglCKLwNZHUYAfGozSFh1gB34qptNBxFsI4HbbrGFAiEA/WNdCz9mJ+Gi4SErzl5MXYmkyYDwiLnVBcRM47vgfQM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkAerqACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqfxg/8C4LqXZCU3gt1reCscoWEZsi5MBx3+wKOd0sl6qTO9IJBMnmU\r\nqsk+zubwV/kLwyVdLskdOfui9QModnHqUcobjiXX6oRgopb4xg9OpMh5mZrJ\r\nLW14oMYgEoQ+Tp96A67QAY1t70ODXiPlQg0fTHcheNpjm2vrfZltIbzoA3ou\r\nwVdOQtuKZkP/4/flxCOhepmHJ4VjZN1YXnAT1DrL3IDqOCMONc9bbNGvm6TC\r\n4qvZ3liwSMVr11o7SwaIUfClDHOBUfGgqLIsIUgz+LRFzICFahOWO1xwTH6u\r\nkMH66MRdscIFtYuQZPbNG3arIiqs4gkuKYHxKYR8iSaKstWIBwWXZETYXzrA\r\nWRkXQ/nLLXrppuT+h78XGsSSdrlAOvNa3+iXVoeqIGyf5vma9Uwlq/Bw7CM3\r\nts0scJVMOiNlsoWCGlgLEXOl3rYap49Mea36lwr4MFtIxbFuUrC6UZa1409s\r\nvUDQXuKhwHLEfon2u7S9mkoYMRSuMSUm2GVdLlduM/SdAXApslEnG8weXC2A\r\ntn0WcmDQpqu02d2GA4L2GBoQXpUiEblR7rLlc/Zy6JN7XuF62duQGXrOrG9N\r\nHInOkMk90msUE4dRg/4J8DS70nBwWNjs6AKnrEOEAe42mtxRL0zaOaZfKbOp\r\n2X9j2VudNzXK7EnPB69Y3wZp4zTlsCRypQ0=\r\n=rscA\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"adrian.insua","email":"adrianiy@ext.inditex.com"},"directories":{},"maintainers":[{"name":"adrian.insua","email":"adrianiy@ext.inditex.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/octokit-plugin-create-pull-request_1.1.2_1677847274076_0.29707081957065284"},"_hasShrinkwrap":false}},"time":{"created":"2023-03-03T09:58:46.266Z","1.1.0":"2023-03-03T09:58:46.504Z","modified":"2023-03-03T12:41:14.328Z","1.1.1":"2023-03-03T11:08:51.013Z","1.1.2":"2023-03-03T12:41:14.249Z"},"maintainers":[{"name":"adrian.insua","email":"adrianiy@ext.inditex.com"}],"description":"Octokit plugin to create a pull request with multiple file changes","homepage":"https://github.com/adrianiy/octokit-plugin-create-pull-request#readme","keywords":["github","octokit","plugin","pull-request"],"repository":{"type":"git","url":"git+https://github.com/adrianiy/octokit-plugin-create-pull-request.git"},"bugs":{"url":"https://github.com/adrianiy/octokit-plugin-create-pull-request/issues"},"license":"MIT","readme":"# octokit-plugin-create-pull-request\n\n> Octokit plugin to create a pull request with multiple file changes\n\n[![@latest](https://img.shields.io/npm/v/octokit-plugin-create-pull-request.svg)](https://www.npmjs.com/package/octokit-plugin-create-pull-request)\n[![Build Status](https://github.com/gr2m/octokit-plugin-create-pull-request/workflows/Test/badge.svg)](https://github.com/gr2m/octokit-plugin-create-pull-request/actions?query=workflow%3ATest+branch%3Amain)\n\nFeatures\n\n- Retrieves the repository’s default branch unless `base` branch is set\n- Makes multiple file changes using a single commit\n- Creates a fork if the authenticated user does not have write access to the repository\n- Can update existing pull request\n\n## Usage\n\n<table>\n<tbody valign=top align=left>\n<tr><th>\nBrowsers\n</th><td width=100%>\n\nLoad `octokit-plugin-create-pull-request` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [cdn.pika.dev](https://cdn.pika.dev)\n\n```html\n<script type=\"module\">\n  import { Octokit } from \"https://cdn.pika.dev/@octokit/core\";\n  import { createPullRequest } from \"https://cdn.pika.dev/octokit-plugin-create-pull-request\";\n</script>\n```\n\n</td></tr>\n<tr><th>\nNode\n</th><td>\n\nInstall with `npm install @octokit/core octokit-plugin-create-pull-request`. Optionally replace `@octokit/core` with a core-compatible module\n\n```js\nconst { Octokit } = require(\"@octokit/core\");\nconst { createPullRequest } = require(\"octokit-plugin-create-pull-request\");\n```\n\n</td></tr>\n</tbody>\n</table>\n\n```js\nconst MyOctokit = Octokit.plugin(createPullRequest);\n\nconst TOKEN = \"secret123\"; // create token at https://github.com/settings/tokens/new?scopes=repo\nconst octokit = new MyOctokit({\n  auth: TOKEN,\n});\n\n// Returns a normal Octokit PR response\n// See https://octokit.github.io/rest.js/#octokit-routes-pulls-create\noctokit\n  .createPullRequest({\n    owner: \"user-or-org-login\",\n    repo: \"repo-name\",\n    title: \"pull request title\",\n    body: \"pull request description\",\n    head: \"pull-request-branch-name\",\n    base: \"main\" /* optional: defaults to default branch */,\n    update: false /* optional: set to `true` to enable updating existing pull requests */,\n    forceFork: false /* optional: force creating fork even when user has write rights */,\n    changes: [\n      {\n        /* optional: if `files` is not passed, an empty commit is created instead */\n        files: {\n          \"path/to/file1.txt\": \"Content for file1\",\n          \"path/to/file2.png\": {\n            content: \"_base64_encoded_content_\",\n            encoding: \"base64\",\n          },\n          // deletes file if it exists,\n          \"path/to/file3.txt\": null,\n          // updates file based on current content\n          \"path/to/file4.txt\": ({ exists, encoding, content }) => {\n            // do not create the file if it does not exist\n            if (!exists) return null;\n\n            return Buffer.from(content, encoding)\n              .toString(\"utf-8\")\n              .toUpperCase();\n          },\n          \"path/to/file5.sh\": {\n            content: \"echo Hello World\",\n            encoding: \"utf-8\",\n            // one of the modes supported by the git tree object\n            // https://developer.github.com/v3/git/trees/#tree-object\n            mode: \"100755\",\n          },\n        },\n        commit:\n          \"creating file1.txt, file2.png, deleting file3.txt, updating file4.txt (if it exists), file5.sh\",\n        /* optional: if not passed, will be the authenticated user and the current date */\n        author: {\n          name: \"Author LastName\",\n          email: \"Author.LastName@acme.com\",\n          date: new Date().toISOString(), // must be ISO date string\n        },\n        /* optional: if not passed, will use the information set in author */\n        committer: {\n          name: \"Committer LastName\",\n          email: \"Committer.LastName@acme.com\",\n          date: new Date().toISOString(), // must be ISO date string\n        },\n      },\n    ],\n  })\n  .then((pr) => console.log(pr.data.number));\n```\n\nBy default, a pull request is created, even if no files have been changed. To prevent an empty pull request, set `options.createWhenEmpty` to `false`. If no pull request has been created, `octokit.createPullRequest()` resolves with `null`.\n\nBy default, commits are always created, even if no files have been updated. To prevent empty commits, set `options.changes[].emptyCommit` to `false`. To set a custom commit message for empty commits, set `emptyCommit` to a string.\n\nFor using this plugin with another plugin, you can import the `composeCreatePullRequest` function, which accepts an `octokit` instance as first argument, and the same options as `octokit.createPullRequest` as second argument.\n\n```js\nimport { Octokit } from \"@octokit/core\";\nimport { composeCreatePullRequest } from \"octokit-plugin-create-pull-request\";\n\nexport function myPlugin(octokit) {\n  return {\n    async myFunction(options) {\n      // custom code here\n\n      const response = await composeCreatePullRequest(octokit, options);\n\n      // more custom code here\n\n      return response;\n    },\n  };\n}\n```\n\n## LICENSE\n\n[MIT](LICENSE)\n","readmeFilename":"README.md"}