A JavaScript toolkit for the GitHub API.
Questions tagged [octokit-js]
82 questions
0
votes
0 answers
Probot: Creating Multiple Issue Comments
For Probot issue comments create functionality, Probot is creating multiple comments as a loop when the bot created a comment as "Improper command. Please follow the syntax: /label [add/remove], label1, label2, label3". Here is the…
0
votes
0 answers
Unable to delete a release from a GitHub action
I have a node script that deletes releases and tags from a GitHub repository using Octokit-js.
It works exactly as expected when I run it from a workstation remotely with the necessary environment variables set for the token, owner, and…

Ritmo2k
- 993
- 6
- 17
0
votes
1 answer
Track GitHub session on the server
I am writing a language server that sometimes needs to access data from a GitHub repository. I am following this sample to obtain GitHub authentication. The sample is based on client-side code, so I'm wondering how I would provide the authenticated…

GabeV
- 859
- 8
- 21
0
votes
1 answer
How to give write permission to a team for a repository using Octokit/GitHub API?
I'm using JavaScript and Octokit to dynamically create repositories in an organization and set a series of options.
Everything works, except adding write permissions to a team for the repository created.
Just to be clear, by write permission I mean…

Carlo
- 4,016
- 7
- 44
- 65
0
votes
1 answer
What is the octokit.js's method for updating Readme file?
I am using Octokit/rest to edit github files. When I am trying to edit the ReadMe file using the octokit.repos.createOrUpdateFileContents it throws the following error:
HttpError: Not Found
And this is the url I received in the error…

Nithur
- 111
- 2
- 10
0
votes
1 answer
Deleting folder from github using octokit/rest
I'm trying to use octokit/rest to remove a directory programaticcaly. I have the following code
import {Octokit as Github} from '@octokit/rest';
const githubToken = "read from vault"
const getCurrentCommit = async (
github: Github,
org:…

Matto
- 2,538
- 2
- 18
- 23
0
votes
0 answers
Can't override some HTTP headers with github.request() in actions/github-script workflow script
My workflow's script with action/github-script(v6) step:
const response = await github.request('POST https://example.com', {
headers: {
authorization: 'Bearer xxx',
accept: 'application/vnd.heroku+json; version=3', // I want header to be…

tlenex
- 488
- 1
- 5
- 13
0
votes
0 answers
List Pull request using the Github API in the pre-request-script from Postman
I have to retrieve the Github pull request, using the url:
https://api.github.com/repos///pulls/ and the repo
https://api.github.com/repos//
I tried to use Octokit.js -> https://github.com/octokit/core.js#readme…

rasilvap
- 1,771
- 3
- 31
- 70
0
votes
1 answer
Probot Octokit - Get file from specific branch
I'm using Probot's Octokit to read a file from a repo:
const content = await context.octokit.repos.getContent({owner: "OWNER", repo: "REPO", path:"PATH"})
However this only works for the master branch, is there a way to get the file from another…

Ben Rauzi
- 564
- 4
- 13
0
votes
1 answer
GitHub - octokit - ArrayBuffer[Unit8Contents] -> converting to a tar / zip file
I am started to work with nodejs octokit. With following code (sample code from github documentation) I was able to retrieve a .tar file from a Github repository:
await octokit.request('GET /repos/{owner}/{repo}/tarball/{ref}', {
owner:…

Harald
- 243
- 2
- 12
0
votes
1 answer
Jest mocking of Octokit library
My code looks like this,
const octokit = new Octokit({
auth: process.env.auth,
});
const queries = JSON.stringify(event.queryStringParameters);
const repos = await octokit.request(`GET /repos/{org}/{repo}/tarball`);
I am able to mock the…

Jaragan Ittah
- 36
- 1
- 2
0
votes
1 answer
Override url when getting paginated results in octokit-js
We have to access our instance of GHE through a proxy, which requires a port number to be added to the URL. We create an Octokit instance like
new Octokit({
baseUrl: 'https://api.github.mycompany.com:5000',
...
}
We then get the page iterator…

sparkofreason
- 141
- 6
0
votes
0 answers
AWS Lambda not running for-loop
I'm trying to run a for loop in my AWS Lambda that loops through an array. The array has a length of 11, but the for-loop only runs for 3 iterations before stopping (I can't find an error in the try/catch log).
This code is part of a Github bot, and…

Ganning Xu
- 263
- 4
- 13
0
votes
1 answer
Given a JWT, how do you create an octokit client from it? Using NodeJS
Given a JWT, how do you create an octokit client from it? Using NodeJS.

Johnny5
- 463
- 2
- 5
- 16
0
votes
1 answer
Why spread operator is missing out data?
I am working with Github API using Octokit library.
I have a function which list out all the repository of a user(username). I have called this function on click of a button called Fetch
For sake of simplicity, I am rendering out only 1st…

anshul
- 661
- 9
- 27