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);
}
Extends Branch
Branch on GitHub.
-
owner
-
name
-
options
Writes content into the branch https://developer.github.com/v3/git/blobs/#get-a-blob
-
entry
ContentEntry
Returns Promise<ContentEntry> written content with sha values set
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
https://developer.github.com/v3/repos/contents/#get-repository-content
-
name
string
https://developer.github.com/v3/repos/contents/
-
entries
AsyncIterator<ContentEntry>
Extends RepositoryGroup
Represents github repo owner either
- users
- organization
https://developer.github.com/v3/repos/#create-a-repository-for-the-authenticated-user
Returns Promise<Repository> newly created repository
https://developer.github.com/v3/repos/#delete-a-repository
-
name
string
Map attributes between external and internal representation.
Extends MultiGroupProvider
GitHub provider. Lookup a repository. known environment variables
- GITHUB_TOKEN or GH_TOKEN api token
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
https://developer.github.com/v3/repos/#list-repositories-for-the-authenticated-user
All possible base urls
- github:
- git@github.com
- git://github.com
- git+ssh://github.com
- https://github.com
- git+https://github.com
Returns Array<string> common base urls of all repositories
We are called github.
Returns string github
Returns string default environment name prefix for the provider instance
Extends PullRequest
Github pull request.
https://developer.github.com/v3/pulls/#merge-a-pull-request
-
method
(optional, default"MERGE"
)
All valid merge methods.
Returns Set<string> valid merge methods
https://developer.github.com/v3/pulls/#list-pull-requests
-
repository
Repository -
filter
Object (optional, default{}
)
https://developer.github.com/v3/pulls/#create-a-pull-request
-
source
Branch -
destination
Branch -
options
Object?
Extends Repository
Repository on GitHub.
Returns string "main"
https://docs.github.com/en/rest/reference/commits#list-commits
-
options
Object
Returns AsyncIterable<Commit>
https://developer.github.com/v3/git/commits/#get-a-commit
-
sha
string
Returns Promise<Object> response
-
sha
string
Returns Promise<Array<Object>>
Returns Promise<Object> newly created tree
https://developer.github.com/v3/repos/branches/#list-branches
https://docs.github.com/en/rest/reference/repos#list-repository-tags
Returns string github https url
Deliver the url of issue tracking system.
Returns string
Deliver the url of the repositories home page.
Returns string
API endpoint for ourselfs.
Returns string
https://docs.github.com/de/rest/repos/repos?apiVersion=2022-11-28#update-a-repository
Get sha of a ref. https://developer.github.com/v3/git/refs/
-
ref
string
Returns Promise<string> sha of the ref
https://docs.github.com/en/github-ae@latest/rest/git/refs#update-a-reference
https://developer.github.com/v3/pulls/#update-a-pull-request
-
name
string
https://developer.github.com/v3/repos/hooks/
With npm do:
npm install github-repository-provider
BSD-2-Clause