<div id="top"></div>

# @nfq/storybook-github-issues

[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/license/mit/)
[![EsLint](https://github.com/nfqde/nfq-storybook-github-issues/actions/workflows/eslint.yml/badge.svg)](https://github.com/nfqde/nfq-storybook-github-issues/actions/workflows/eslint.yml)
[![Horusec](https://github.com/nfqde/nfq-storybook-github-issues/actions/workflows/horusec.yml/badge.svg)](https://github.com/nfqde/nfq-storybook-github-issues/actions/workflows/horusec.yml)
[![Cypress](https://github.com/nfqde/nfq-storybook-github-issues/actions/workflows/cypress.yml/badge.svg)](https://github.com/nfqde/nfq-storybook-github-issues/actions/workflows/cypress.yml)

---

1. [Description](#description)
2. [Getting started](#getting-started)
    1. [Installation](#installation)
    2. [PeerDependencies](#peerdependencies)
3. [Usage](#usage)
5. [Support](#support)

---

## Description: [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

This is an Storybook plugin to manage issues in Github from Storybook directly so Designers can give Feedback without leaving Storybook.

<p align="right">(<a href="#top">back to top</a>)</p>

---

## Getting started

To setup the project locally follow the next steps:

### Installation

To install the package run
```sh
npm install @nfq/storybook-github-issues
```
if you are on yarn
```sh
yarn add @nfq/storybook-github-issues
```
or on pnpm
```sh
pnpm install @nfq/storybook-github-issues
```
   
### PeerDependencies:

The following PeerDependencies are needed so the addon does work (Most get installed with storybook itself):

- @storybook/blocks >= 7
- @storybook/components >= 7
- @storybook/core-events >= 7
- @storybook/manager-api >= 7
- @storybook/preview-api >= 7
- @storybook/theming >= 7
- @storybook/types >= 7
- react >= 18
- react-dom >= 18
- storybook >= 7

<p align="right">(<a href="#top">back to top</a>)</p>

---

## Usage

To use the addon go to your storybook config file in "<projectRoot>/.storybook/main.ts" and add the following lines:

```diff
const config: StorybookConfig = {
    stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
    addons: [
        "@storybook/addon-links",
        "@storybook/addon-essentials",
        "@storybook/addon-interactions",
+        "@nfq/storybook-github-issues"
    ],
    framework: {
        name: "@storybook/nextjs",
        options: {},
    },
    docs: {
        autodocs: "tag",
    }
};
```

Add an .env file to your project and add the following variables:

```env
STORYBOOK_GITHUB_OWNER: <your github owner>,
STORYBOOK_GITHUB_REPOSITORY: <your github repository>,
STORYBOOK_GITHUB_PUBLIC_TOKEN: <your github token>,
```

For the token to work you need to create a Github Token with the following permissions:

- access to the repository (Please use fine grained tokens and only give access to the repository you need)
- read:metadata
- read:discussions
- write:discussions
- read:issues
- write:issues
- read:pull_requests
- write:pull_requests

<p align="right">(<a href="#top">back to top</a>)</p>

---

## Support

Christoph Kruppe - [https://github.com/ckruppe] - c.kruppe@nfq.de  

<p align="right">(<a href="#top">back to top</a>)</p>