github-repository-provider
v9.0.21
Published
repository provider for github
Downloads
2,548
Maintainers
Readme
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
name
string
entries
Parameters
Returns AsyncGenerator<ContentEntry> all matching entries in the branch
removeEntries
https://developer.github.com/v3/repos/contents/
Parameters
entries
AsyncIterable<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
name
string
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('[email protected]: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
- github:
- [email protected]
- git://github.com
- git+ssh://github.com
- https://github.com
- git+https://github.com
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
Repositoryfilter
Object (optional, default{}
)
open
https://developer.github.com/v3/pulls/#create-a-pull-request
Parameters
source
Branchdestination
Branchoptions
Object?
GithubRepository
Extends Repository
Repository on GitHub.
defaultBranchName
Returns string "main"
commits
https://docs.github.com/en/rest/reference/commits#list-commits
Parameters
options
Object
Returns AsyncIterable<Commit>
commitForSha
https://developer.github.com/v3/git/commits/#get-a-commit
Parameters
sha
string
Returns Promise<Object> response
tree
Parameters
sha
string
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
ref
string
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
deletePullRequest
https://developer.github.com/v3/pulls/#update-a-pull-request
Parameters
name
string
initializeHooks
https://developer.github.com/v3/repos/hooks/
install
With npm do:
npm install github-repository-provider
license
BSD-2-Clause