Socket
Socket
Sign inDemoInstall

@octokit/action

Package Overview
Dependencies
Maintainers
3
Versions
134
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/action

GitHub API client for GitHub Actions


Version published
Weekly downloads
35K
decreased by-7.59%
Maintainers
3
Weekly downloads
 
Created
Source

action.js

GitHub API client for GitHub Actions

@latest Build Status Greenkeeper

Usage

Browsers

@octokit/action is not meant for browser usage.

Node

Install with npm install @octokit/action

const { Octokit } = require("@octokit/action");
// or: import { Octokit } from "@octokit/action";

Create an issue using REST API

const octokit = new Octokit();
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");

// See https://developer.github.com/v3/issues/#create-an-issue
const { data } = await octokit.request("POST /repos/:owner/:repo/issues", {
  owner,
  repo,
  title: "My test issue"
});
console.log("Issue created: %d", data.html_url);

Create an issue using GraphQL

const octokit = new Octokit();
const eventPayload = require(process.env.GITHUB_EVENT_PATH);
const repositoryId = eventPayload.repository.node_id;

const response = await octokit.graphql(
  `
  mutation($repositoryId:ID!, $title:String!) {
    createIssue(input:{repositoryId: $repositoryId, title: $title}) {
      issue {
        number
      }
    }
  }
  `,
  {
    repositoryId,
    title: "My test issue"
  }
);

Hooks, plugins, and more

@octokit/action is build upon @octokit/core. Refer to its README for the full API documentation.

How it works

@octokit/action is simply a @octokit/core constructor, pre-authenticate using `@octokit/auth-action.

The source code is … simple: src/index.ts.

License

MIT

Keywords

FAQs

Package last updated on 12 Oct 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc