github-repository-provider

9.0.10 • Public • Published

npm License Typed with TypeScript bundlejs downloads GitHub Issues Build Status Styled with prettier Commitizen friendly Known Vulnerabilities Coverage Status

github-repository-provider

repository provider for github

import { GithubProvider } from 'github-repository-provider';

const config = GithubProvider.optionsFromEnvironment(process.env);
const provider = new GithubProvider(config);
const repository = await provider.repository(`myuser/repo1`);

for async (const entry of repository.entries('\*_/_.md')) {
console.log(entry.name);
}

API

Table of Contents

GithubBranch

Extends Branch

Branch on GitHub.

Parameters

  • owner
  • name
  • options

writeEntry

Writes content into the branch https://developer.github.com/v3/git/blobs/#get-a-blob

Parameters

  • entry ContentEntry

Returns Promise<ContentEntry> written content with sha values set

commit

https://developer.github.com/v3/git/trees/#create-a-tree https://developer.github.com/v3/git/commits/#create-a-commit https://developer.github.com/v3/git/refs/#update-a-reference

Parameters

entry

https://developer.github.com/v3/repos/contents/#get-repository-content

Parameters

removeEntries

https://developer.github.com/v3/repos/contents/

Parameters

  • entries AsyncIterator<ContentEntry>

GithubOwner

Extends RepositoryGroup

Represents github repo owner either

  • users
  • organization

createRepository

https://developer.github.com/v3/repos/#create-a-repository-for-the-authenticated-user

Parameters

Returns Promise<Repository> newly created repository

deleteRepository

https://developer.github.com/v3/repos/#delete-a-repository

Parameters

attributeMapping

Map attributes between external and internal representation.

GithubProvider

Extends MultiGroupProvider

GitHub provider. Lookup a repository. known environment variables

  • GITHUB_TOKEN or GH_TOKEN api token

Examples

import GithubProvider from 'github-repository-provider';

const ghp = new GithubProvider();
const r1 = ghp.repository('git@github.com:arlac77/github-repository-provider.git');
const r2 = ghp.repository('git://github.com/arlac77/github-repository-provider.git');
const r3 = ghp.repository('git+ssh://github.com/arlac77/github-repository-provider.git');
const r4 = ghp.repository('https://github.com/arlac77/github-repository-provider.git#master');
const r5 = ghp.repository('git+https://github.com/arlac77/github-repository-provider.git#master');
const r6 = ghp.repository('arlac77/github-repository-provider');
// different ways to address the same repository

initializeRepositories

https://developer.github.com/v3/repos/#list-repositories-for-the-authenticated-user

repositoryBases

All possible base urls

Returns Array<string> common base urls of all repositories

name

We are called github.

Returns string github

instanceIdentifier

Returns string default environment name prefix for the provider instance

GithubPullRequest

Extends PullRequest

Github pull request.

_merge

https://developer.github.com/v3/pulls/#merge-a-pull-request

Parameters

  • method (optional, default "MERGE")

update

validMergeMethods

All valid merge methods.

Returns Set<string> valid merge methods

list

https://developer.github.com/v3/pulls/#list-pull-requests

Parameters

  • repository Repository
  • filter Object (optional, default {})

open

https://developer.github.com/v3/pulls/#create-a-pull-request

Parameters

  • source Branch
  • destination Branch
  • options Object?

GithubRepository

Extends Repository

Repository on GitHub.

defaultBranchName

Returns string "main"

commits

https://docs.github.com/en/rest/reference/commits#list-commits

Parameters

Returns AsyncIterable<Commit>

commitForSha

https://developer.github.com/v3/git/commits/#get-a-commit

Parameters

Returns Promise<Object> response

tree

Parameters

Returns Promise<Array<Object>>

addTree

Parameters

Returns Promise<Object> newly created tree

initializeBranches

https://developer.github.com/v3/repos/branches/#list-branches

initializeTags

https://docs.github.com/en/rest/reference/repos#list-repository-tags

url

Returns string github https url

issuesURL

Deliver the url of issue tracking system.

Returns string

homePageURL

Deliver the url of the repositories home page.

Returns string

api

API endpoint for ourselfs.

Returns string

update

https://docs.github.com/de/rest/repos/repos?apiVersion=2022-11-28#update-a-repository

refId

Get sha of a ref. https://developer.github.com/v3/git/refs/

Parameters

Returns Promise<string> sha of the ref

_setRefId

Parameters

setRefId

https://docs.github.com/en/github-ae@latest/rest/git/refs#update-a-reference

Parameters

Returns Promise<Object>

deletePullRequest

https://developer.github.com/v3/pulls/#update-a-pull-request

Parameters

initializeHooks

https://developer.github.com/v3/repos/hooks/

install

With npm do:

npm install github-repository-provider

license

BSD-2-Clause

Package Sidebar

Install

npm i github-repository-provider

Weekly Downloads

355

Version

9.0.10

License

BSD-2-Clause

Unpacked Size

57.7 kB

Total Files

13

Last publish

Collaborators

  • arlac77