diff --git a/README.md b/README.md index 8e8c308..ccfdbb7 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # Pull Request Comment Branch +[![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=xt0rted/pull-request-comment-branch)](https://dependabot.com) + Get the head ref and sha of a pull request comment. Workflows for pull request comments are triggered using the [`issue_comment`](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows#issue-comment-event-issue_comment) event which runs for both issues and pull requests. diff --git a/dist/index.js b/dist/index.js index 369c592..ab4e37a 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1452,12 +1452,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", { value: true }); const core_1 = __webpack_require__(470); const github_1 = __webpack_require__(469); -const rest_1 = __webpack_require__(0); function run() { return __awaiter(this, void 0, void 0, function* () { try { - const token = core_1.getInput("repo_token", { required: true }); - const client = new rest_1.Octokit({ auth: `token ${token}` }); + const client = new github_1.GitHub(core_1.getInput("repo_token", { required: true })); const { data: { pull_request } } = yield client.issues.get(Object.assign(Object.assign({}, github_1.context.repo), { issue_number: github_1.context.issue.number })); if (!pull_request) { throw Error("Comment is not on a pull request"); @@ -6947,9 +6945,6 @@ exports.RequestError = RequestError; "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; @@ -6960,13 +6955,13 @@ var __importStar = (this && this.__importStar) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); // Originally pulled from https://github.com/JasonEtco/actions-toolkit/blob/master/src/github.ts const graphql_1 = __webpack_require__(898); -const rest_1 = __importDefault(__webpack_require__(0)); +const rest_1 = __webpack_require__(0); const Context = __importStar(__webpack_require__(262)); const httpClient = __importStar(__webpack_require__(539)); // We need this in order to extend Octokit -rest_1.default.prototype = new rest_1.default(); +rest_1.Octokit.prototype = new rest_1.Octokit(); exports.context = new Context.Context(); -class GitHub extends rest_1.default { +class GitHub extends rest_1.Octokit { constructor(token, opts) { super(GitHub.getOctokitOptions(GitHub.disambiguate(token, opts))); this.graphql = GitHub.getGraphQL(GitHub.disambiguate(token, opts)); diff --git a/package-lock.json b/package-lock.json index d5aaced..29a44dd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,13 +10,13 @@ "integrity": "sha512-IbCx7oefq+Gi6FWbSs2Fnw8VkEI6Y4gvjrYprY3RV//ksq/KPMlClOerJ4jRosyal6zkUIc8R9fS/cpRMlGClg==" }, "@actions/github": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/@actions/github/-/github-2.1.0.tgz", - "integrity": "sha512-G4ncMlh4pLLAvNgHUYUtpWQ1zPf/VYqmRH9oshxLabdaOOnp7i1hgSgzr2xne2YUaSND3uqemd3YYTIsm2f/KQ==", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@actions/github/-/github-2.1.1.tgz", + "integrity": "sha512-kAgTGUx7yf5KQCndVeHSwCNZuDBvPyxm5xKTswW2lofugeuC1AZX73nUUVDNaysnM9aKFMHv9YCdVJbg7syEyA==", "requires": { "@actions/http-client": "^1.0.3", "@octokit/graphql": "^4.3.1", - "@octokit/rest": "^16.15.0" + "@octokit/rest": "^16.43.1" } }, "@actions/http-client": { @@ -134,14 +134,14 @@ } }, "@types/node": { - "version": "13.7.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.0.tgz", - "integrity": "sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ==" + "version": "13.7.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.4.tgz", + "integrity": "sha512-oVeL12C6gQS/GAExndigSaLxTrKpQPxewx9bOcwfvJiJge4rr7wNaph4J+ns5hrmIV2as5qxqN8YKthn9qh0jw==" }, "@zeit/ncc": { - "version": "0.21.0", - "resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.21.0.tgz", - "integrity": "sha512-RUMdvVK/w78oo+yBjruZltt0kJXYar2un/1bYQ2LuHG7GmFVm+QjxzEmySwREctaJdEnBvlMdUNWd9hXHxEI3g==", + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/@zeit/ncc/-/ncc-0.21.1.tgz", + "integrity": "sha512-M9WzgquSOt2nsjRkYM9LRylBLmmlwNCwYbm3Up3PDEshfvdmIfqpFNSK8EJvR18NwZjGHE5z2avlDtYQx2JQnw==", "dev": true }, "atob-lite": { @@ -342,9 +342,9 @@ "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==" }, "typescript": { - "version": "3.7.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz", - "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==", + "version": "3.8.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.8.2.tgz", + "integrity": "sha512-EgOVgL/4xfVrCMbhYKUQTdF37SQn4Iw73H5BgCrF1Abdun7Kwy/QZsE/ssAy0y4LxBbvua3PIbFsbRczWWnDdQ==", "dev": true }, "universal-user-agent": { diff --git a/package.json b/package.json index e2e47c1..ad3d0d6 100644 --- a/package.json +++ b/package.json @@ -21,12 +21,11 @@ "license": "MIT", "dependencies": { "@actions/core": "^1.2.0", - "@actions/github": "^2.1.0" + "@actions/github": "^2.1.1" }, "devDependencies": { - "@octokit/rest": "^16.43.1", - "@types/node": "^13.7.0", - "@zeit/ncc": "^0.21.0", - "typescript": "^3.7.2" + "@types/node": "^13.7.4", + "@zeit/ncc": "^0.21.1", + "typescript": "^3.8.2" } } diff --git a/src/main.ts b/src/main.ts index d9a6d8a..6738e33 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,11 +1,9 @@ import { getInput, setFailed, setOutput } from "@actions/core"; -import { context } from "@actions/github"; -import { Octokit } from "@octokit/rest"; +import { context, GitHub } from "@actions/github"; export async function run() { try { - const token = getInput("repo_token", { required: true }); - const client = new Octokit({ auth: `token ${token}` }); + const client = new GitHub(getInput("repo_token", { required: true })); const { data: { pull_request } } = await client.issues.get({ ...context.repo,