octokit / plugin-rest-endpoint-methods.js Goto Github PK
View Code? Open in Web Editor NEWOctokit plugin adding one method for all of api.github.com REST API endpoints
License: MIT License
Octokit plugin adding one method for all of api.github.com REST API endpoints
License: MIT License
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Location: package.json
Error type: The renovate configuration file contains some invalid settings
Message: Invalid configuration option: @pika/pack, Invalid configuration option: author, Invalid configuration option: jest, Invalid configuration option: keywords, Invalid configuration option: license, Invalid configuration option: name, Invalid configuration option: packageRules[0].@octokit/types, Invalid configuration option: packageRules[0].deprecation, Invalid configuration option: packageRules[1].@gimenete/type-writer, Invalid configuration option: packageRules[1].@octokit/core, Invalid configuration option: packageRules[1].@octokit/graphql, Invalid configuration option: packageRules[1].@pika/pack, Invalid configuration option: packageRules[1].@pika/plugin-build-node, Invalid configuration option: packageRules[1].@pika/plugin-build-web, Invalid configuration option: packageRules[1].@pika/plugin-ts-standard-pkg, Invalid configuration option: packageRules[1].@types/fetch-mock, Invalid configuration option: packageRules[1].@types/jest, Invalid configuration option: packageRules[1].@types/node, Invalid configuration option: packageRules[1].fetch-mock, Invalid configuration option: packageRules[1].fs-extra, Invalid configuration option: packageRules[1].jest, Invalid configuration option: packageRules[1].lodash.camelcase, Invalid configuration option: packageRules[1].lodash.set, Invalid configuration option: packageRules[1].lodash.upperfirst, Invalid configuration option: packageRules[1].mustache, Invalid configuration option: packageRules[1].npm-run-all, Invalid configuration option: packageRules[1].prettier, Invalid configuration option: packageRules[1].semantic-release, Invalid configuration option: packageRules[1].semantic-release-plugin-update-version-in-files, Invalid configuration option: packageRules[1].sort-keys, Invalid configuration option: packageRules[1].string-to-jsdoc-comment, Invalid configuration option: packageRules[1].ts-jest, Invalid configuration option: packageRules[1].typescript, Invalid configuration option: packageRules[2].@octokit/core, Invalid configuration option: publishConfig, Invalid configuration option: release, Invalid configuration option: renovate, Invalid configuration option: scripts, Invalid configuration option: version
We were unable to find the enterprise-admin/users#suspend-a-user endpoint
As a GHES admin, I want to use Octokit.js to be able to suspend my users. This endpoint exists, and I can use the Octokit.request method, however I'd love to have the helper wrapper in this plugin.
/cc @wilsonwong1990
13.7.0
to 13.7.1
.This version is covered by your current version range and after updating it in your project the build failed.
@types/node is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
This issue contains a list of Renovate updates and their statuses.
These updates are awaiting their schedule. Click on a checkbox to ignore the schedule.
These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
Here's my code:
const { Octokit } = require('@octokit/rest');
const {retry} = require('@octokit/plugin-retry')
const {paginate} = require('@octokit/plugin-paginate-rest')
const {endpoints} = require('@octokit/plugin-rest-endpoint-methods');
const MyOctokit = Octokit.plugin(retry, paginate, endpoints);
octokit = new MyOctokit({
auth: "token " + process.env.GIT_TOKEN,
previews: ["luke-cage-preview", "hellcat-preview", "symmetra-preview"],
});
async function tester() {
const list = await octokit.paginate(octokit.activity.listWatchedReposForAuthenticatedUser)
console.log(`got back ${list.length} repos`)
}
tester().then().catch(err => {
console.dir(err)
})
What happens is that when I look at the list
object, it contains just a collection of endpoint URLs. What am I missing??
https://github.com/austenstone/copilot-usage/blob/main/package.json
https://github.com/austenstone/copilot-usage/blob/main/package-lock.json
5.16.2
5.13.0
10.0.0
10.2.0
> tsc && ncc build src/index.ts -o dist --source-map --license LICENSE
node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:2527:55 - error TS2339: Property 'POST /repos/{owner}/{repo}/pages/deployment' does not exist on type 'Endpoints'.
2527 parameters: RequestParameters & Endpoints["POST /repos/{owner}/{repo}/pages/deployment"]["parameters"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:2528:33 - error TS2339: Property 'POST /repos/{owner}/{repo}/pages/deployment' does not exist on type 'Endpoints'.
2528 response: Endpoints["POST /repos/{owner}/{repo}/pages/deployment"]["response"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 2 errors in the same file, starting at: node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:2527
What happened?
I'd like to call Self-hosted runner groups endpoints, but these are missing completely.
They are present in openapi-types
, plugin-paginate-rest
and types
, but are not referenced in plugin-rest-endpoint-methods
nor plugin-enterprise-server
.
What did you expect to happen?
Self-hosted runner groups endpoints should be available in plugin-rest-endpoint-methods
and plugin-enterprise-server
.
What the problem might be
const requestOptions = octokit.repos.getContents.endpoint({
owner: "foo",
repo: "bar",
path: "path/to/binary/file",
mediaType: {
format: "raw"
}
});
What happened?
it appears that the latest patch has changed some type information which is causing build process to fail. Error seems to be similar to the ones in #172
$ tsc
Error: node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts(257,60): error TS2339: Property 'POST /repos/{owner}/{repo}/actions/runs/{run_id}/retry' does not exist on type 'Endpoints'.
Error: node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts(258,33): error TS2339: Property 'POST /repos/{owner}/{repo}/actions/runs/{run_id}/retry' does not exist on type 'Endpoints'.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 2
What happened?
Current entry in @octokit/plugin-rest-endpoint-methods/dist-types/generated/types.d.ts:
declare type SearchIssuesAndPullRequestsResponseItemsItem = {
assignee: null;
body: string;
closed_at: null;
comments: number;
comments_url: string;
created_at: string;
events_url: string;
html_url: string;
id: number;
labels: Array<SearchIssuesAndPullRequestsResponseItemsItemLabelsItem>;
labels_url: string;
milestone: null;
node_id: string;
number: number;
pull_request: SearchIssuesAndPullRequestsResponseItemsItemPullRequest;
repository_url: string;
score: number;
state: string;
title: string;
updated_at: string;
url: string;
user: SearchIssuesAndPullRequestsResponseItemsItemUser;
};
What did you expect to happen?
I'd expect closed_at
to be string | null
. I'm unsure about the other null
types as well.
What happened?
There are enum types are being specified as string
when they are really string enums.
What did you expect to happen?
That these enum types are specified as string enums. For example:
enum CheckRunStatus {
queued = 'queued',
in_progress = 'in_progress',
completed = 'completed'
}
export enum CheckSuiteConclusion {
action_required = 'action_required',
cancelled = 'cancelled',
timed_out = 'timed_out',
failure = 'failure',
neutral = 'neutral',
success = 'success'
}
...
type ChecksListSuitesForRefResponseCheckSuitesItem = {
...
conclusion: CheckSuiteConclusion;
status: CheckRunStatus
};
vs.
type ChecksListSuitesForRefResponseCheckSuitesItem = {
...
conclusion: string;
status: string
};
What the problem might be
How this repo generates its types.
🚨 Reminder! Less than one month left to migrate your repositories over to Snyk before Greenkeeper says goodbye on June 3rd! 💜 🚚💨 💚
Find out how to migrate to Snyk at greenkeeper.io
4.3.1
to 4.4.0
.This version is covered by your current version range and after updating it in your project the build failed.
@octokit/graphql is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
In the createReview
method, the comment's position
is marked as necessary according to TypeScript's typings, but the documentation states it's not: https://docs.github.com/en/rest/pulls/reviews?apiVersion=2022-11-28#create-a-review-for-a-pull-request
"dependencies": {
"@actions/core": "^1.2.6",
"@actions/exec": "^1.0.4",
"@actions/github": "^4.0.0"
},
"devDependencies": {
"@types/jest": "^26.0.10",
"@types/node": "^14.6.1",
"@typescript-eslint/eslint-plugin": "^3.10.1",
"@typescript-eslint/parser": "^3.10.1",
"@vercel/ncc": "^0.24.0",
"eslint": "^7.7.0",
"eslint-config-sentry": "^1.43.0",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-prettier": "^3.1.4",
"husky": "^4.2.5",
"jest": "^26.4.2",
"jest-circus": "^26.4.2",
"js-yaml": "^3.13.1",
"lint-staged": "^10.2.13",
"prettier": "^2.1.1",
"ts-jest": "^26.3.0",
"typescript": "^4.0.2"
}
node is v19.5
src/createReviewCommentsFromPatch.ts:74:7 - error TS2322: Type '{ path: string; body: string; side: string; start_side: string; start_line: number | undefined; line: number; }[]' is not assignable to type 'PullsCreateReviewParamsComments[]'.
Property 'position' is missing in type '{ path: string; body: string; side: string; start_side: string; start_line: number | undefined; line: number; }' but required in type 'PullsCreateReviewParamsComments'.
74 comments,
~~~~~~~~
node_modules/@octokit/types/dist-types/generated/Endpoints.d.ts:39740:5
39740 position: number;
~~~~~~~~
'position' is declared here.
This issue is reserved for people who never contributed to Open Source before. We know that the process of creating a pull request is the biggest barrier for new contributors. This issue is for you 💝
The Pika CDN is now Skypack, see https://www.pika.dev/cdn. The CDN at https://cdn.pika.dev/ no longer works, all URLs must be replaced with the new CDN: https://cdn.skypack.dev/. We currently recommend using cdn.pika.dev
to import the library into the browser, but that no longer works. Replacing it with cdn.skypack.dev
will make it work again.
🙋 Claim this issue: Comment below.
More than one person can work on this issue, don't worry if it's already claimed.
📝 Update the file \README.md (press the little pen Icon) and edit as shown below:
@@ -13,12 +13,12 @@
Browsers
</th><td width=100%>
-Load `@octokit/plugin-rest-endpoint-methods` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [cdn.pika.dev](https://cdn.pika.dev)
+Load `@octokit/plugin-rest-endpoint-methods` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [cdn.skypack.dev](https://cdn.skypack.dev)
```html
<script type="module">
- import { Octokit } from "https://cdn.pika.dev/@octokit/core";
- import { restEndpointMethods } from "https://cdn.pika.dev/@octokit/plugin-rest-endpoint-methods";
+ import { Octokit } from "https://cdn.skypack.dev/@octokit/core";
+ import { restEndpointMethods } from "https://cdn.skypack.dev/@octokit/plugin-rest-endpoint-methods";
</script>
```
💾 Commit your changes
🔀 Start a Pull Request. There are two ways how you can start a pull request:
🏁 Done Ask for a review :)
If there are more than one pull requests with the correct change, we will merge the first one, but attribute the change to all authors who made the same change using @Co-authored-by
, so yo can be sure your contribution will count.
Leave a comment below!
This issue was created by First-Timers-Bot.
What happened?
Couldn't find any versions for "@octokit/plugin-rest-endpoint-methods" that matches "2.4.0"
What did you expect to happen?
To install it with no errors
What the problem might be
My findings so far are that yesterday this issue didn’t happen, then earlier today (6 hours ago) you released this version @octokit/[email protected]
, which got me thinking maybe it’s (flushing, npm publish, idk), so I checked at npm WEBSITE and it did release properly and the latest tag is on 2.4.0
Afterwards I ran npm view @octokit/plugin-rest-endpoint-methods versions
and that’s where all the fun begins, the response doesn’t contain version 2.4.0
Thanks in advance :)
What’s missing?
Remove unnecessary step for CodeQL workflow:
plugin-rest-endpoint-methods.js/.github/workflows/codeql.yml
Lines 23 to 26 in fb9fd94
Why?
Right now, when CodeQL
workflow runs, it prints the following warning message:
[CodeQL-Build](https://github.com/octokit/plugin-rest-endpoint-methods.js/runs/5705550731?check_suite_focus=true)
1 issue was detected with this workflow: git checkout HEAD^2 is no longer necessary. Please remove this step as Code Scanning recommends analyzing the merge commit for best results.
Example: https://github.com/octokit/plugin-rest-endpoint-methods.js/actions/runs/2045651822
I maintain octokit-commit-multiple-files, which has stopped working with plugin-rest-endpoint-methods.js
7.0. (Bug report: mheap/octokit-commit-multiple-files#110)
It seems to be related to the refactoring in #622
I previously attached a new method to octokit.rest.repos
like so:
module.exports = function (octokit) {
octokit.rest.repos.createOrUpdateFiles = plugin.bind(null, octokit);
};
Is there a way to register new methods after this refactoring?
@octokit/rest 19.0.7
Node.js v18.15.0
/private/tmp/octokit-test/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js:1929
const { decorations, endpointDefaults } = endpointMethodsMap.get(scope).get(methodName);
^
TypeError: Cannot destructure property 'decorations' of 'endpointMethodsMap.get(...).get(...)' as it is undefined.
at Object.get (/private/tmp/octokit-test/node_modules/@octokit/plugin-rest-endpoint-methods/dist-node/index.js:1929:13)
at /private/tmp/octokit-test/index.js:14:44
at Object.<anonymous> (/private/tmp/octokit-test/index.js:32:3)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.15.0
Now that octokitcore@6 has moved to ESM the peer dependency usage results in problems when attempting to load the module. This is affecting versions of this plugin before it moved to ESM
Octokit/[email protected], Node 18.19.0
Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in ...../node_modules/@octokit/core/package.json
at new NodeError (node:internal/errors:405:5)
at exportsNotFound (node:internal/modules/esm/resolve:366:10)
at packageExportsResolve (node:internal/modules/esm/resolve:656:13)
at resolveExports (node:internal/modules/cjs/loader:584:36)
What happened?
The type inferred for setLabels is incorrect. It is constrained to:
string[] & {
name: string
}[]
What did you expect to happen?
It should be:
string[] | {
name: string
}[]
As the API documentation specifies that you can pass either an array of strings, or an array of objects that have names (as opposed to an array which satisfies both).
What the problem might be
The definition appears to be:
"issues/set-labels": {
parameters: {
path: {
owner: components["parameters"]["owner"];
repo: components["parameters"]["repo"];
/** issue_number parameter */
issue_number: components["parameters"]["issue_number"];
};
};
responses: {
/** Response */
200: {
content: {
"application/json": components["schemas"]["label"][];
};
};
410: components["responses"]["gone"];
422: components["responses"]["validation_failed"];
};
requestBody: {
content: {
"application/json": Partial<{
/** The names of the labels to add to the issue. You can pass an empty array to remove all labels. **Note:** Alternatively, you can pass a single label as a `string` or an `array` of labels directly, but GitHub recommends passing an object with the `labels` key. */
labels?: string[];
}> &
Partial<{
labels?: {
name: string;
}[];
}>;
};
};
};
Using the createOrUpdateFileContents in a the pull-request-artifacts action is failing to upload, and returning a 504 error, and the message "Error: We couldn't respond to your request in time. Sorry about that. Please try resubmitting your request and contact us if the problem persists."
plugin-rest-endpoint-methods 10.1.2
Run gavv/[email protected]
Artifacts repo: meshtastic/artifacts
Artifacts branch: device
Artifacts prefix: "pr2739-"
Processing artifact: ./firmware-2.2.16.d952da8.zip
GET /repos/meshtastic/artifacts/contents/.?ref=device - 200 in 264ms
Uploading file pr2739-firmware-2.2.16.d952da8.zip (first time)
PUT /repos/meshtastic/artifacts/contents/pr2739-firmware-2.2.16.d952da8.zip - 504 in 11150ms
Error: We couldn't respond to your request in time. Sorry about that. Please try resubmitting your request and contact us if the problem persists.
Hello,
I have a big problem. And I knew something was wrong. As I also stated in my email that someone had access to my my previous email address to sign into github.
I am sick. And fatigued. Just so I know what to do with this problem. As I do not know how or what it is that you need, can you please let me know?? And I will do my best to provide whatever it is you need. Even though I really don't know what is a json file.
I am just afraid of my personal things and important files to be gone as many did!
Please let me know how I can help. And I will do my best. Just please don't do anything with my files. And if you can stop this on me please and let's take action together as I was a member in github a long time ago.
Awaiting your response. Thank you.
I would also love this to be shared across everyone who thinks that I am the target! Because this is not fare at all. We could've just talked from the beginning about this. Rather than attacking my phone with all these bots, making me think I'm a part of a new development! Which was all a big holks????
Not a right approach at all. If it was surely the target? Fine go for it. But IT IS NOT ME AND I DO NOT KNOW WHAT IS GOING ON!!!
PLEASE HELP!
I get error Unhandled error: TypeError: github.orgs.cancelInvitation is not a function
with this code:
- name: CancelInvitation
uses: actions/github-script@v4
[...]
script: |
github.orgs.cancelInvitation({
org: "organization",
invitation_id: 00000,
});
A call from console.log('Test: ', github.orgs);
shows that the method is really missing.
Another little question:
I use allway in my GH-Workflows the octokit methods with "github." instead of "octokit.rest."
Wrong?
Describe the bug
I am trying to create a repository in a workflow in an enterprise organization.
Unfortunately the parameter with the value 'visibility: "internal"' seems to be ignored.
To Reproduce
Using this code snippet
uses: actions/[email protected]
[...]
const data = await github.repos.createInOrg({
org: "test-org",
name: "Test-Organisation",
auto_init: true,
visibility: "internal"
});
Expected behavior
A repo should be created, which has the status internal, instead a public one is created.
(Coming from github-script/#94)
This is a follow up issue to octokit/plugin-paginate-rest.js#124 (comment)
We need to add @octokit/core
as a peerDependency to address a problem with yarn 2. It is something I planned to do anyway, but wanted to figure out automated testing to assure compatibility of the plugins with the latest @octokit/core
.
I only want to define compatibility with the lowest version, in this case v3. Compare pull request https://github.com/octokit/plugin-paginate-rest.js/pull/130/files.
I would appreciate help, this is a great issue for a first-time contributor
What happened?
The latest release of plugin-rest-endpoint-methods
is causing compilation errors for @octokit/rest
and probot
:
node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:1761:60 - error TS2339: Property 'POST /repos/{owner}/{repo}/environments/{environment_name}' does not exist on type 'Endpoints'.
1761 parameters: RequestParameters & Omit<Endpoints["POST /repos/{owner}/{repo}/environments/{environment_name}"]["parameters"], "baseUrl" | "headers" | "mediaType">;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:1762:33 - error TS2339: Property 'POST /repos/{owner}/{repo}/environments/{environment_name}' does not exist on type 'Endpoints'.
1762 response: Endpoints["POST /repos/{owner}/{repo}/environments/{environment_name}"]["response"];
See: googleapis/release-please#805, googleapis/repo-automation-bots#1462
What did you expect to happen?
Compilation should not throw errors
What the problem might be
Checklist
Environment
Versions
├─┬ @octokit/[email protected]
│ ├─┬ @octokit/[email protected]
│ │ ├─┬ @octokit/[email protected]
│ │ ├─┬ @octokit/[email protected]
│ │ ├─┬ @octokit/[email protected]
│ │ │ ├─┬ @octokit/[email protected]
│ │ │ ├─┬ @octokit/[email protected]
│ │ ├─┬ @octokit/[email protected]
│ ├─┬ @octokit/[email protected]
│ ├── @octokit/[email protected]
│ └─┬ @octokit/[email protected]
What happened?
The following code is not working.
async function start() {
const git = new Octokit({
auth: 'xxx'
})
await git.gists.update({
gist_id: id,
files: {
content: 'update from api',
filename: 'postcss.config.js'
}
})
}
start()
Minimal test case to reproduce the problem
import { Octokit } from '@octokit/rest'
async function start() {
const git = new Octokit({
auth: 'xxx'
})
await git.gists.update({
gist_id: id,
files: {
content: 'update from api',
filename: 'postcss.config.js'
}
})
}
start()
What did you expect to happen?
Working correctly.
What the problem might be
Wrong type define and document.
The official document is: https://developer.github.com/v3/gists/#update-a-gist
And the type define should be:
type GistsUpdateEndpoint = {
/**
* gist_id parameter
*/
gist_id: string;
/**
* A descriptive name for this gist.
*/
description?: string;
/**
* The filenames and content that make up this gist.
*/
files?: {
[filename:string]: GistsUpdateParamsFiles
};
};
I am trying to compile the GH integration code with the following dependencies:
"dependencies": {
"@octokit/types": "^6.37.0",
"@octokit/rest": "^18.12.0",
"@octokit/plugin-paginate-rest": "^2.19.0",
"@octokit/plugin-rest-endpoint-methods": "^5.15.0"
},
"devDependencies": {
"eslint": "^7.8.1",
"typescript": "^3.9.7",
"@zeit/ncc": "^0.22.3"
}
NodeJS version 14.19.1, npm version 6.14.16
What happened?
An error is thrown on the compile stage
> tsc
node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:437:60 - error TS2339: Property 'POST /content_references/{content_reference_id}/attachments' does not exist on type 'Endpoints'.
437 parameters: RequestParameters & Omit<Endpoints["POST /content_references/{content_reference_id}/attachments"]["parameters"], "baseUrl" | "headers" | "mediaType">;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:438:33 - error TS2339: Property 'POST /content_references/{content_reference_id}/attachments' does not exist on type 'Endpoints'.
438 response: Endpoints["POST /content_references/{content_reference_id}/attachments"]["response"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:441:60 - error TS2339: Property 'POST /repos/{owner}/{repo}/content_references/{content_reference_id}/attachments' does not exist on type 'Endpoints'.
441 parameters: RequestParameters & Omit<Endpoints["POST /repos/{owner}/{repo}/content_references/{content_reference_id}/attachments"]["parameters"], "baseUrl" | "headers" | "mediaType">;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:442:33 - error TS2339: Property 'POST /repos/{owner}/{repo}/content_references/{content_reference_id}/attachments' does not exist on type 'Endpoints'.
442 response: Endpoints["POST /repos/{owner}/{repo}/content_references/{content_reference_id}/attachments"]["response"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 4 errors.
What did you expect to happen?
Compilation without errors.
What the problem might be
I suspect that it is somehow related to this issue, but I have version that were issued much lated than the ones described in the fix of this issue.
What happened?
The ChecksListSuitesForRefResponseCheckSuitesItem
type is missing keys that exist in the actual object. They are:
And are missing from the documention at https://developer.github.com/v3/checks/suites/#list-check-suites-for-a-specific-ref
What did you expect to happen?
The keys to exist.
What the problem might be
How this repo generates its types.
Reproduced on runkit at https://runkit.com/sean-krail/octokit-plugin-rest-endpoint-methods.js
The file is currently manually copied & pasted from octokit/rest.js/index.d.ts
What’s missing?
Why?
Alternatives you tried
Node v10 has been deprecated so there is no need to keep giving support to it in our CI.
You can find more details here
Hi!
I've trying to figure out by reading the CONTRIBUTING.md
file and few of the merged PRs how this repository updates the endpoints but I'm still not very sure if there is an automated process... and also what's the process to release new versions of the library
There are few endpoints that I see are outdated given what the official GH docs say. Few examples are:
https://docs.github.com/en/rest/reference/repos#get-repository-permissions-for-a-user
This endpoint has a new field (role_name
), that's not exposed by this lib
https://docs.github.com/en/rest/reference/repos#update-branch-protection
This endpoint accepts a new attribute (required_status_checks.checks
) that's not supported here
What would be the process to update these two calls?
What happened?
Expected required properties in documentation for create check run
are missing:
name
head_sha
Instead a strange *
property appears (scripts/update-endpoints/generated/endpoints.json
Line 9888):
"parameters": [
{
"name": "owner",
"description": "",
"in": "PATH",
"type": "string",
"required": true,
"enum": null,
"allowNull": false,
"mapToData": null,
"validation": null,
"alias": null,
"deprecated": null
},
{
"name": "repo",
"description": "",
"in": "PATH",
"type": "string",
"required": true,
"enum": null,
"allowNull": false,
"mapToData": null,
"validation": null,
"alias": null,
"deprecated": null
},
{
"name": "status",
"description": "",
"in": "BODY",
"type": null,
"required": false,
"enum": ["queued", "in_progress"],
"allowNull": false,
"mapToData": null,
"validation": null,
"alias": null,
"deprecated": null
},
{
"name": "*",
"description": "",
"in": "BODY",
"type": "object",
"required": false,
"enum": null,
"allowNull": false,
"mapToData": null,
"validation": null,
"alias": null,
"deprecated": null
}
]
What did you expect to happen?
To get missing name
and head_sha
required properties when running npm run update-endpoints:fetch-json
What the problem might be
github-openapi-graphql-query
lib is returning wrong info probably. Opened issue in that project: gr2m/github-openapi-graphql-query#11
part of octokit/octokit.js#15
This is a breaking change.
Removes the legacy of rest endpoint methods on octokit.*
. Add a restEndpointMethodsLegacy
export for @octokit/rest
, @octokit/actions
and others to make the change easier to absorb.
I'm using Create review PR API to create PR comments by sending multiple comments as array in single request input field
comments
. It works as expected.
When I tried to split single request Create review PR API into multiple requests by limiting
comments
input batch array of 20 comments per API call then it succeeds for first batch but second batch request fails with error "422: Unprocessable Entity: Review comments is invalid and Review threads is invalid"
422
Validation failed, or the endpoint has been spammed.
Do we have any maximum number/length/character limitation for
comments
array in single request Create review PR API input fieldcomments
Why issue happens only for multiple requests to Create review PR API? Is that due to rate limiting/spam issues for endpoint?
actions/github-script@v6 octokit-core.js/3.6.0 Node.js/16.13.0 (linux; x64)
RequestError [HttpError]: Unprocessable Entity: "Review comments is invalid and Review threads is invalid"
at /runner/_work/_actions/actions/github-script/v6/dist/index.js:6172:21
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
status: 422,
response: {
url: 'https://api.github.com/repos/{ORG}/{REPO}/pulls/{PR}/reviews',
status: 422,
headers: {
'access-control-allow-origin': '*',
'access-control-expose-headers': 'ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, X-GitHub-Request-Id, Deprecation, Sunset',
connection: 'close',
Error: Unhandled error: HttpError: Unprocessable Entity: "Review comments is invalid and Review threads is invalid"
'content-length': '206',
'content-security-policy': "default-src 'none'",
'content-type': 'application/json; charset=utf-8',
date: 'Wed, 21 Dec 2022 07:14:45 GMT',
'referrer-policy': 'origin-when-cross-origin, strict-origin-when-cross-origin',
server: 'GitHub.com',
'strict-transport-security': 'max-age=31536000; includeSubdomains; preload',
vary: 'Accept-Encoding, Accept, X-Requested-With',
'x-accepted-oauth-scopes': '',
'x-content-type-options': 'nosniff',
'x-frame-options': 'deny',
'x-github-api-version-selected': '2022-11-28',
'x-github-media-type': 'github.v3',
'x-github-request-id': 'FDAD:1CB0:FEC18:12B194:63A2B260',
'x-oauth-scopes': 'repo',
'x-ratelimit-limit': '5000',
'x-ratelimit-remaining': '4819',
'x-ratelimit-reset': '1671608480',
'x-ratelimit-resource': 'core',
'x-ratelimit-used': '181',
'x-xss-protection': '0'
},
data: {
message: 'Unprocessable Entity',
errors: [Array],
documentation_url: 'https://docs.github.com/rest/reference/pulls#create-a-review-for-a-pull-request'
}
},
request: {
method: 'POST',
url: 'https://api.github.com/repos/{ORG}/{REPO}/pulls/{PR}/reviews',
headers: {
accept: 'application/vnd.github.-preview+json',
'user-agent': 'actions/github-script octokit-core.js/3.6.0 Node.js/16.13.0 (linux; x64)',
authorization: 'token [REDACTED]',
'content-type': 'application/json; charset=utf-8'
},
body: '{"event":"COMMENT","commit_id":"a6f6058f93f6bc119324e4824248d6206d087b86","comments":[{COMMENTS_ARR}]}',
request: { agent: [Agent], hook: [Function: bound bound register] }
}
}
What happened?
Trying to use octokit.repos.deleteDeployment but function doesn't exist thus resulting in exception being thrown.
What did you expect to happen?
Expected it to be there since it's part of the documentation
What the problem might be
I don't know but I can say as much that using octokit.request('DELETE /repos/:owner/:repo/deployments/:deployment_id',{})
works.
https://octokit.github.io/rest.js/v18#repos-get-content includes the following code example:
octokit.repos.getContent({
owner,
repo,
path,
});
However, the method is actually called getContents
(with an s
):
What happened?
CodeQL Check Run on this PR fails and it's not possible to merge.
What did you expect to happen?
CodeQL Check Run should pass.
I think I've found a typo in this method name
What happened?
TypeScript compiler depends on this, and it appears that the latest patch has changed some type information which is causing TS compiler build process to fail for versions 3.9+
Errors
[21:44:13] Finished 'generateLibs' after 571 ms
node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:961:60 - error TS2339: Property 'GET /user/:migration_id/repositories' does not exist on type 'Endpoints'.
961 parameters: RequestParameters & Omit<Endpoints["GET /user/:migration_id/repositories"]["parameters"], "baseUrl" | "headers" | "mediaType">;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:962:33 - error TS2339: Property 'GET /user/:migration_id/repositories' does not exist on type 'Endpoints'.
962 response: Endpoints["GET /user/:migration_id/repositories"]["response"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/plugin-paginate-rest/dist-types/generated/paginating-endpoints.d.ts:987:31 - error TS2339: Property 'GET /user/:migration_id/repositories' does not exist on type 'Endpoints'.
987 parameters: Endpoints["GET /user/:migration_id/repositories"]["parameters"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/plugin-paginate-rest/dist-types/generated/paginating-endpoints.d.ts:988:29 - error TS2339: Property 'GET /user/:migration_id/repositories' does not exist on type 'Endpoints'.
988 response: Endpoints["GET /user/:migration_id/repositories"]["response"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 4 errors.
2.x
branch failed. 🚨I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the 2.x
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here is some links that can help you:
If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.
3.0.0
on branch 2.x
cannot be published as it is out of range.Based on the releases published on other branches, only versions within the range >=2.4.0 <3.0.0
can be published from branch 2.x
.
The following commits are responsible for the invalid release:
octokit.actions.listDownloadsForSelfHostedRunnerApplication({ owner, repo })
(813f0a8)contexts
/users
/teams
etc parameters to data
for branch protection endpoints (d48f560)mapToData
parameter decoriation (23811aa)octokit.repos.uploadReleaseAsset()
workarounds for types generation (d66ddfb)octokit.repos.uploadReleaseAsset
(4abd16e)octokit.repos.uploadReleaseAsset()
(6eb4063)octokit.repos.uploadReleaseAsset
with owner, repo and release_id options (d3bd732)src/generated/types.ts
(262bc54)generated/types.ts
was built with / copied from (92f003b).registerEndpoints
(51a85da)octokit.repos.uploadReleaseAsset
endpoint method (7177356)octokit.issues.updateLabel({ current_name, name})
is now octokit.issues.updateLabel({ name, new_name})
(834d570)octokit.pulls.createFromIssue
, octokit.git.listRefs
, octokit.repos.getCommitRefSha
(b7641eb)Those commits should be moved to a valid branch with git merge or git cherry-pick and removed from branch 2.x
with git revert or git reset.
A valid branch could be master
.
See the workflow configuration documentation for more details.
Good luck with your project ✨
Your semantic-release bot 📦🚀
What happened?
Trying to compile in Typescript - getting the following error:
node_modules/@octokit/rest/node_modules/@octokit/plugin-paginate-rest/dist-types/generated/paginating-endpoints.d.ts:557:31 - error TS2339: Property 'GET /repos/:owner/:repo/code-scanning/analyses' does not exist on type 'Endpoints'.
557 parameters: Endpoints["GET /repos/:owner/:repo/code-scanning/analyses"]["parameters"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/rest/node_modules/@octokit/plugin-paginate-rest/dist-types/generated/paginating-endpoints.d.ts:558:29 - error TS2339: Property 'GET /repos/:owner/:repo/code-scanning/analyses' does not exist on type 'Endpoints'.
558 response: Endpoints["GET /repos/:owner/:repo/code-scanning/analyses"]["response"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:519:60 - error TS2339: Property 'GET /repos/:owner/:repo/code-scanning/alerts/:alert_number' does not exist on type 'Endpoints'.
519 parameters: RequestParameters & Omit<Endpoints["GET /repos/:owner/:repo/code-scanning/alerts/:alert_number"]["parameters"], "baseUrl" | "headers" | "mediaType">;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:520:33 - error TS2339: Property 'GET /repos/:owner/:repo/code-scanning/alerts/:alert_number' does not exist on type 'Endpoints'.
520 response: Endpoints["GET /repos/:owner/:repo/code-scanning/alerts/:alert_number"]["response"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:527:60 - error TS2339: Property 'GET /repos/:owner/:repo/code-scanning/analyses' does not exist on type 'Endpoints'.
527 parameters: RequestParameters & Omit<Endpoints["GET /repos/:owner/:repo/code-scanning/analyses"]["parameters"], "baseUrl" | "headers" | "mediaType">;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:528:33 - error TS2339: Property 'GET /repos/:owner/:repo/code-scanning/analyses' does not exist on type 'Endpoints'.
528 response: Endpoints["GET /repos/:owner/:repo/code-scanning/analyses"]["response"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:531:60 - error TS2339: Property 'PATCH /repos/:owner/:repo/code-scanning/alerts/:alert_number' does not exist on type 'Endpoints'.
531 parameters: RequestParameters & Omit<Endpoints["PATCH /repos/:owner/:repo/code-scanning/alerts/:alert_number"]["parameters"], "baseUrl" | "headers" | "mediaType">;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:532:33 - error TS2339: Property 'PATCH /repos/:owner/:repo/code-scanning/alerts/:alert_number' does not exist on type 'Endpoints'.
532 response: Endpoints["PATCH /repos/:owner/:repo/code-scanning/alerts/:alert_number"]["response"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:535:60 - error TS2339: Property 'POST /repos/:owner/:repo/code-scanning/sarifs' does not exist on type 'Endpoints'.
535 parameters: RequestParameters & Omit<Endpoints["POST /repos/:owner/:repo/code-scanning/sarifs"]["parameters"], "baseUrl" | "headers" | "mediaType">;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@octokit/rest/node_modules/@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types.d.ts:536:33 - error TS2339: Property 'POST /repos/:owner/:repo/code-scanning/sarifs' does not exist on type 'Endpoints'.
536 response: Endpoints["POST /repos/:owner/:repo/code-scanning/sarifs"]["response"];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using "@octokit/rest": "^18.0.6",
My code is:
return this.octokit.repos
.getContent({ owner, repo, path: gitPath, ref: branch })
.then((res) => {
....
What did you expect to happen?
It should compile
I'd love to be able to use the contents of dist-src/generated/endpoints.js
as an import in my ESM project, but unless I am doing something wrong, I haven't found a way and am instead copying that file at runtime and vendoring it in my project, since the project is only exporting the endpoints to methods and not the raw data.
Happy to contribute an export but also may just be doing this wrong so asking the basic question here first...
Version 5 of @actions/github
, I was able to do this within my tests:
import { getOctokit } from '@actions/github'
import type { Endpoints } from '@octokit/types'
import sinon from 'sinon'
const octokit = getOctokit('token')
const stubLabelList = () => {
return sinon.stub(octokit.rest.issues, 'listLabelsForRepo').resolves({
data: [MOCK_LIST_LABELS],
status: 200
} as Endpoints["GET /repos/{owner}/{repo}/labels"]["response"])
}
}
const github = {
getOctokit: () => octokit
}
// pass github and stubLabelList to other test functions etc
As of version 6, I've had to do something like:
import { getOctokit } from '@actions/github'
import type { Endpoints } from '@octokit/types'
import sinon from 'sinon'
const octokit = getOctokit('token')
const github = {
getOctokit: () => {
...octokit,
rest: {
issues: {
listLabelsForRepo: () => {
return {
data: [MOCK_LIST_LABELS],
status: 200
} as Endpoints["GET /repos/{owner}/{repo}/labels"]["response"])
}
}
}
}
}
I noticed this was a change in way the endpoints are generated and is now done via a proxy as of #622, could this of introduced unwanted side effects or is this the intended behaviour?
@actions/github: v6
NodeJS: 18
TypeError: Cannot destructure property ‘decorations’ of ‘endpointMethodsMap.get(...).get(...)’ as it is undefined.
What happened?
Before v3 (beta), the following code worked
octokit.repos.uploadReleaseAsset.endpoint({
url: result.data.upload_url,
headers: {
"content-type": "text/plain"
},
file: Buffer.from("Hello, world!\n"),
name: "test-upload.txt"
});
The value of the file
parameter is sent directly in the request body, without a { file }
namespace.
In v3.0.0-beta.1 the data is sent using the { file }
namespace instead
What did you expect to happen?
What the problem might be
What happened?
The code block of addLabels.md
is badly formatted (indentation is wrong), and the page is missing documentation.
Though the GitHub docs page is also rather confusing:
You can pass an empty array to remove all labels.
Is that actually correct or was it copied from "Set labels for an issue" by accident? It would be rather surprising if an 'add' operation is able to delete something.
but GitHub recommends passing an object with the
labels
key
Not quite sure what "object" means here, the previous sentence said the type is array; same applies to the "Set labels for an issue" endpoint.
The examples for this endpoint as well as "Set labels for an issue" seem to be copied from "list labels"; they don't actually specify labels to add / set
What’s missing?
many types, such as SearchCommitsResponse
are not exposed. alternatively, perhapes we consider enhanced type inference on .paginate(...)
to infer expected output types from inputs
Why?
consider the following:
const res = await octokit.paginate(searchCommitOptions) // PaginationResults<unknown>
it would be great have better typing here. it is constrained because it expects a generic--<T>(options: OctokitTypes.EndpointOptions): Promise<PaginationResults<T>>;
--and i cannot pass SearchCommitsResponse
in, because it's not exported.
Alternatives you tried
n/a
master
branch failed. 🚨I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this 💪.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here is some links that can help you:
If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.
semantic-release cannot push the version tag to the branch master
on the remote Git repository with URL https://x-access-token:[secure]@github.com/octokit/plugin-rest-endpoint-methods.js
.
This can be caused by:
Good luck with your project ✨
Your semantic-release bot 📦🚀
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.