Questions tagged [octokit-js]

A JavaScript toolkit for the GitHub API.

82 questions
2
votes
2 answers

Add check to a specific workflow-run/check-suite using octokit

I have a project with Github Actions that implements multiple workflows that can be triggered by a single push event (depending on path filter). So a push with a single commit can trigger multiple workflows, so far so good. In each workflow I am…
Andreas Linden
  • 12,489
  • 7
  • 51
  • 67
2
votes
1 answer

How to automatically run a Github Action after creating a repository from an organization's template?

With octokit a repository can be created that exists in an organization using: require("dotenv").config(); const { Octokit } = require("@octokit/rest"); const cwa = new Octokit({ auth: process.env.TOKEN, //create Github personal token }); const…
DᴀʀᴛʜVᴀᴅᴇʀ
  • 7,681
  • 17
  • 73
  • 127
2
votes
2 answers

Add content to an existing file in Github with Octokit js

I have come across the below code on the internet. const { Octokit } = require("@octokit/rest"); const { Base64 } = require("js-base64"); const fs = require("fs"); const { Octokit } = require("@octokit/rest"); const { Base64 } =…
Harshatej M
  • 61
  • 2
  • 7
2
votes
1 answer

github.getOctokit(myToken) returns empty values for GitHub Action in JavaScript

I'm trying to make a GitHub action that runs when someone comments on a pull request (I'm using issue_comment). In my index.js, I'm running the following lines: const core = require("@actions/core"); const github =…
milk
  • 131
  • 5
1
vote
2 answers

How can I use octokit to list open PRs from all repos in my org?

I would like to write a script in Javascript to query all open github PRs in all repos in my org. I can use this URL to do it in a browser: https://my.github.server/pulls?q=is%3Aopen+is%3Apr+org%3Amy-org-name. But using octokit, I need to supply the…
Graeme Perrow
  • 56,086
  • 21
  • 82
  • 121
1
vote
1 answer

GitHub: Skipping Workflow on Issues Update via API

Maybe this is out of the box, maybe not. But I can't find this in any of the documentation. I know you can skip workflows on Push and Pull_Requests. However, I need to skip workflows when updating Issues via the REST API. My current workflow yaml…
a11smiles
  • 1,190
  • 1
  • 9
  • 21
1
vote
1 answer

GitHub API limit array length to 250

When calling the GitHub API with Octokit to get all ahead commits of a fork repo by comparing each of their branches together, if the fork repo contains more than 300 commits ahead then octokit only returns a maximum of 250. I have searched the…
Thinh Tran
  • 776
  • 1
  • 7
  • 11
1
vote
1 answer

How do you paginate the results of GitHub's compare commit API

I am not able to paginate the results of the Github compare commit REST API as defined here: https://docs.github.com/en/github-ae@latest/rest/commits/commits#compare-two-commits I perform a GET operation in the following format: url =…
Andrew B
  • 25
  • 6
1
vote
2 answers

octokit createPullRequest for JSON files

I have been trying to create a pull request using the createPullRequest plugin from octokit and so far for simple text files it works well, but when I am trying to commit some changes into a JSON file in the repository, I get something like…
kratia
  • 21
  • 6
1
vote
0 answers

Getting a 404 error whenever I fork a repo

I'm trying to create a website that can fork a repo using Octokit, but I keep getting 404 errors. const octokit = new Octokit({ auth: accessToken }) try { const response = await octokit.request('POST /repos/{owner}/{repo}/forks', { …
Cristian
  • 495
  • 2
  • 9
  • 35
1
vote
0 answers

Github API with octokit- app authentication for create a repository dispatch event gives 404 not found

I'm trying to authenticate through a Github app to launch a repository dispatch event as per these docs. The app has the permissions metadata:read and contents:read&write as mentioned in the docs. With the code below, authentication succeeds, but I…
AJP
  • 515
  • 2
  • 13
1
vote
1 answer

What's the datatype of the value returned by octokit.createPullRequest() in octokit-plugin-create-pull-request?

I want to make a pull request from a react-native app. I am using the octokit-plugin-create-pull-request library from here. They have a function octokit.createPullRequest() in their documentation. I am at a point where I need to know the datatype of…
Ian Munge
  • 27
  • 7
1
vote
1 answer

How to instantiate Octokit for user-as-a-server oAuth?

I want my GitHub app to perform actions on behalf of a user, like creating an issue. I am authenticating my user this way: const { createOAuthAppAuth } = require('@octokit/auth-oauth-app'); const auth = createOAuthAppAuth({ clientType:…
Sydney C.
  • 950
  • 10
  • 21
1
vote
1 answer

How to create a branch using probot (octokit)?

I want to create a branch using Probot. Seeing that it uses octokit/rest.js, I went over the octokit docs but couldn't find a method to do so. So how do I create a branch? Also note that I mean to create a branch so I can pull request later. Edit:…
1
vote
1 answer

What's the point of using octokit/core.js in a browser if storing access tokens in it is not secure?

The documentation of octokit/core.js shows examples of using the module in the browser but doesn't show how the token was acquired or where it is stored. So, I assume the token is readily available in the browser. If storing tokens in the browser is…
drishit96
  • 327
  • 1
  • 2
  • 18