Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/brenopolanski/new-gitlab-issue-url

Generate a URL for opening a new GitLab issue with prefilled title, description, and other fields
https://github.com/brenopolanski/new-gitlab-issue-url

gitlab gitlab-issues npm-package url

Last synced: about 1 month ago
JSON representation

Generate a URL for opening a new GitLab issue with prefilled title, description, and other fields

Awesome Lists containing this project

README

        

# new-gitlab-issue-url

> Generate a URL for opening a new GitLab issue with prefilled title, description, and other fields

GitLab supports prefilling a new issue by setting certain search parameters. This package simplifies generating such URL.

Inspired by *@sindresorhus* [new-github-issue-url](https://github.com/sindresorhus/new-github-issue-url)

## Install

**Using NPM:**

```
npm install --save new-gitlab-issue-url
```

**Using Yarn:**

```
yarn add new-gitlab-issue-url
```

## Usage

```js
const newGitlabIssueUrl = require('new-gitlab-issue-url');

const url = newGitlabIssueUrl({
user: 'brenopolanski',
repo: 'hello-world',
title: 'Hi',
description: '\n\n\n---\nI\'m a human. Please be nice.'
});

//=> 'https://gitlab.com/brenopolanski/hello-world/issues/new?issue[title]=Hi&issue[description]=%0A%0A%0A---%0AI%27m+a+human.+Please+be+nice.'
```

[Try the URL](https://gitlab.com/brenopolanski/hello-world/issues/new?issue[title]=Hi&issue[description]=%0A%0A%0A---%0AI%27m+a+human.+Please+be+nice.)
*(Don't click the "Submit issue" button!)*

## API

### newGitlabIssueUrl(options)

Returns a URL string.

#### options

Type: `object`

You are required to either specify the `repoUrl` option or both the `user` and `repo` options.

##### repoUrl

Type: `string`

The full URL to the repo.

##### user

Type: `string`

GitLab username or organization.

##### repo

Type: `string`

GitLab repo.

##### title

Type: `string`

The issue title.

##### description

Type: `string`

The issue description.

##### template

Type: `string`

Use an [issue template](https://gitlab.com/help/user/project/description_templates#description-templates).

For example, if you want to use a template at `.gitlab/issue_templates/Bug.md`, you would specify `Bug` here.

## License

[MIT License](https://brenopolanski.mit-license.org) © Breno Polanski