# new-github-issue-url

> Generate a URL for opening a new GitHub issue with prefilled title, body, and other fields

Latest version **1.1.0** (published 2025-03-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install new-github-issue-url
pnpm add new-github-issue-url
yarn add new-github-issue-url
bun add new-github-issue-url
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2025-03-09 |
| First published | 2018-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | ^12.20.0 \|\| ^14.13.1 \|\| >=16.0.0 |
| Dependencies | 0 |
| Unpacked size | 8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 252 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | github, issue, new, generate, url, gh, query, search, parameters, params |

## Links

- npm: https://www.npmjs.com/package/new-github-issue-url
- Repository: https://github.com/sindresorhus/new-github-issue-url
- Homepage: https://github.com/sindresorhus/new-github-issue-url#readme
- Issues: https://github.com/sindresorhus/new-github-issue-url/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/new-github-issue-url

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2025-03-09
- 1.0.0 — 2021-10-18
- 0.2.1 — 2019-04-06
- 0.2.0 — 2019-01-28
- 0.1.2 — 2018-11-06
- 0.1.1 — 2018-11-06
- 0.1.0 — 2018-11-06

## README

# new-github-issue-url

> Generate a URL for opening a new GitHub issue with prefilled title, body, and other fields

GitHub supports prefilling a new issue by setting [certain search parameters](https://docs.github.com/en/issues/tracking-your-work-with-issues/creating-an-issue#creating-an-issue-from-a-url-query). This package simplifies generating such URL.

## Install

```sh
npm install new-github-issue-url
```

## Usage

```js
import newGithubIssueUrl from 'new-github-issue-url';
import open from 'open';

const url = newGithubIssueUrl({
	user: 'sindresorhus',
	repo: 'new-github-issue-url',
	body: '\n\n\n---\nI\'m a human. Please be nice.'
});
//=> 'https://github.com/sindresorhus/new-github-issue-url/issues/new?body=%0A%0A%0A---%0AI%27m+a+human.+Please+be+nice.'

// Then open it
await open(url);
```

[Try the URL](https://github.com/sindresorhus/new-github-issue-url/issues/new?body=%0A%0A%0A---%0AI%27m+a+human.+Please+be+nice.)\
*(Don't click the "Submit new issue" button!)*

If you use Electron, check out `electron-util`'s [`openNewGitHubIssue()` method](https://github.com/sindresorhus/electron-util#opennewgithubissueoptions).

## API

### newGithubIssueUrl(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`

GitHub username or organization.

##### repo

Type: `string`

GitHub repo.

##### body

Type: `string`

The issue body.

##### title

Type: `string`

The issue title.

##### template

Type: `string`

Use an [issue template](https://help.github.com/articles/manually-creating-a-single-issue-template-for-your-repository/).

For example, if you want to use a template at `ISSUE_TEMPLATE/unicorn.md`, you would specify `unicorn.md` here.

##### labels

Type: `string[]`

The labels for the issue.

*Requires the user to have the permission to add labels.*

##### milestone

Type: `string`

The milestone for the issue.

*Requires the user to have the permission to add milestone.*

##### assignee

Type: `string`

The user to assign to the issue.

*Requires the user to have the permission to add assignee.*

##### projects

Type: `string[]`

The projects to add the issue to.

The project reference format is `user/repo/<project-number>`, for example, if the URL to the project is `https://github.com/sindresorhus/some-repo/projects/3`, the project reference would be `sindresorhus/some-repo/3`.

*Requires the user to have the permission to add projects.*

##### type

Type: `string`

The [issue type](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/editing-an-issue#adding-or-changing-the-issue-type).

## Related

- [new-github-release-url](https://github.com/sindresorhus/new-github-release-url) - Generate a URL for opening a new GitHub release with prefilled tag, body, and other fields

---
_Source: https://npm.io/package/new-github-issue-url · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
