Skip to content

benjifs/gitlab-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitLab Store

This project was designed to work with @benjifs/micropub but it should be usable with other projects that need to interact with the GitLab API to add, delete, and list files.

There is also a compatible version to work with a GitHub repository: @benjifs/github-store.

Install

npm install @benjifs/gitlab-store

Setup

You will need a Personal access token with the api scope to allow read-write access to the repository files.

Usage

import GitLabStore from '@benjifs/gitlab-store'

const {
	GITLAB_TOKEN,
	GITLAB_USER,
	GITLAB_REPO,
} = process.env

const store = new GitLabStore({
	token: GITLAB_TOKEN,                    // required
	user: GITLAB_USER,                      // required
	repo: GITLAB_REPO,                      // required
	// branch: 'main',                      // default: default branch for repo
	// committer: {                         // default: the authenticated user
	// 	name: 'committer name',
	// 	email: 'committer@example.com'
	// },
})

// ...

const uploaded = await store.createFile('src/example.txt', 'this is a test')

About

Interact with a GitLab repository using the API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published