What is new-github-issue-url?
The new-github-issue-url npm package allows you to easily generate URLs for creating new GitHub issues with pre-filled information such as title, body, labels, and more. This can be particularly useful for creating issue templates or automating issue creation in various workflows.
What are new-github-issue-url's main functionalities?
Generate a basic issue URL
This feature allows you to generate a basic URL for creating a new GitHub issue with a pre-filled title and body.
const newGithubIssueUrl = require('new-github-issue-url');
const url = newGithubIssueUrl({
user: 'username',
repo: 'repository',
title: 'Issue title',
body: 'Issue description'
});
console.log(url);
Generate an issue URL with labels
This feature allows you to generate a URL for creating a new GitHub issue with pre-filled labels.
const newGithubIssueUrl = require('new-github-issue-url');
const url = newGithubIssueUrl({
user: 'username',
repo: 'repository',
title: 'Issue title',
body: 'Issue description',
labels: ['bug', 'help wanted']
});
console.log(url);
Generate an issue URL with assignees
This feature allows you to generate a URL for creating a new GitHub issue with pre-filled assignees.
const newGithubIssueUrl = require('new-github-issue-url');
const url = newGithubIssueUrl({
user: 'username',
repo: 'repository',
title: 'Issue title',
body: 'Issue description',
assignees: ['assignee1', 'assignee2']
});
console.log(url);
Other packages similar to new-github-issue-url
github-url-from-git
The github-url-from-git package converts a Git URL to a GitHub URL. While it doesn't generate new issue URLs, it can be useful for converting repository URLs to their GitHub web counterparts.
github-issue-url
The github-issue-url package generates URLs for GitHub issues, similar to new-github-issue-url. However, it may have fewer customization options compared to new-github-issue-url.
github-url-to-object
The github-url-to-object package parses GitHub URLs into objects and can be used to extract information from GitHub URLs. It doesn't generate new issue URLs but can be useful for handling GitHub URLs in general.
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. This package simplifies generating such URL.
Install
npm install new-github-issue-url
Usage
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.'
});
await open(url);
Try the URL
(Don't click the "Submit new issue" button!)
If you use Electron, check out electron-util
's openNewGitHubIssue()
method.
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.
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.
Related
- new-github-release-url - Generate a URL for opening a new GitHub release with prefilled tag, body, and other fields