Skip to content

Latest commit

 

History

History
28 lines (22 loc) · 740 Bytes

File metadata and controls

28 lines (22 loc) · 740 Bytes

Hello GitHub REST API (GHRA)

GitHub REST API docs works via curl or gh api

  • Octokit core.js is the official JS client for the REST API
    pnpm add @octokit/core

Branch protection

Only available via REST. See index.js for a detailed example.

const response = await octokit.request(
  `GET /repos/${owner}/${repo}/branches/${branch}/protection`,
  {
    owner: owner,
    repo: repo,
    branch: branch,
    headers: {
      "X-GitHub-Api-Version": "2022-11-28",
    },
  },
);