Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ci/release workflow #4

Merged
merged 2 commits into from
Oct 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 0 additions & 68 deletions .github/workflows/build.yml

This file was deleted.

52 changes: 52 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish Release

env:
APP_NAME: gh-issue-creator

on:
push:
tags:
- '*'

jobs:
publish:
name: Publish Release for ${{ matrix.os }}
runs-on: ${{ matrix.os }}

if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
include:
- os: ubuntu-latest
artifact_name: gh-issue-creator
asset_name: gh-issue-creator-linux-amd64
- os: windows-latest
artifact_name: gh-issue-creator.exe
asset_name: gh-issue-creator-windows-amd64
- os: macos-latest
artifact_name: gh-issue-creator
asset_name: gh-issue-creator-macos-amd64

steps:

- name: Check out code
uses: actions/checkout@v3

- name: Build Release
run: cargo build --release

- name: Generate release notes
id: release_notes
run: |
RELEASE_NOTES=$(git tag -l --format='%(contents)' ${{ github.ref }})
echo "$RELEASE_NOTES" > RELEASE_NOTES.md
shell: bash

- name: Upload Release Asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: target/release/${{ matrix.artifact_name }}
asset_name: ${{ matrix.asset_name }}
tag: ${{ github.ref }}
body_from_file: ./RELEASE_NOTES.md
163 changes: 124 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,60 +1,145 @@
# GitHub Issue Creator

GitHub Issue Creator is a Rust application that simplifies the process of creating GitHub issues from a JSON file and adding them into a GitHub project board.
## Introduction

## Table of Contents
GitHub Issue Creator is a Rust application that simplifies the process of creating GitHub issues from a `JSON` file and adding them into a GitHub project board. The app is designed to create GitHub issues using the GitHub GraphQL API with data from a `JSON` file.

- [GitHub Issue Creator](#github-issue-creator)
- [Table of Contents](#table-of-contents)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Configuration](#configuration)
- [Usage](#usage)
## Getting Started

## Prerequisites
This section will guide you through the process of setting up and running the application.

Before using this application, ensure that you have the following prerequisites:
### Prerequisites

- [Rust](https://www.rust-lang.org/) installed on your system.
- A valid GitHub account and a GitHub repository where you want to create issues.
- A GitHub Personal Access Token with the necessary permissions (repo, project) saved in a `.env` file (See the [Configuration](#configuration) section).
- A valid JSON file containing an array of objects, each representing an issue you want to create.
Before you can run the application, you'll need to ensure that you have the following:

## Installation
- A `GH_ACCESS_TOKEN` with necessary permissions such as:
- `repo`
- `workflow`
- `admin:org`
- `project`
- A GitHub repository where the issues will be created.
- A GitHub project linked to the GitHub repository where the issues will be added.
- A JSON file with the data for the issues you want to create in the same directory as your binary.

1. **Clone the Repository**: Start by cloning this repository to your local machine:
### Installation

```bash
git clone https://github.com/olisystems/gh-issue-creator.git
cd gh-issue-creator
```
The installation process involves downloading the binaries from the release assets and running them on your platform. Here's how you can do it:

#### Downloading Binaries from Release Assets

The binaries for the application are automatically built and added to the release assets every time a new release is created. You can download them directly from there.

#### For Ubuntu

1. Open your terminal.
2. Navigate to the directory where you downloaded the binary.
3. Make the binary executable by running the following command:
```bash
chmod +x gh-issue-creator
```
4. You can now run the application with the following command:
```bash
./gh-issue-creator
```

#### For Windows

1. Open Command Prompt.
2. Navigate to the directory where you downloaded the binary.
3. You can now run the application with the following command:
```bash
./gh-issue-creator
```

## Configuration
Configure the application by creating a .env file in the root of the project directory with the following variables:
#### For MacOS

1. Open Terminal.
2. Navigate to the directory where you downloaded the binary.
3. You can now run the application with the following command:
```bash
./gh-issue-creator
```

### Configuration

Before you can run the application, you'll need to set up a `.env` file in the same directory as your binary. This file will store important information such as your access token, repository name, and project number.

#### Setting up the .env File

Here's how you can set up your `.env` file:

1. In the same directory as your binary, create a new file and name it `.env`.
2. Open the `.env` file in a text editor.
3. Add the following lines to the file, replacing `<value>` with your actual information:

```bash
GITHUB_ACCESS_TOKEN=your_github_personal_access_token
REPO_OWNER=your_github_username_or_organization
REPO_NAME=your_repository_name
JSON_FILE_NAME=path/to/your/data.json
ACCESS_TOKEN=<your_access_token>
GH_GRAPHQL_API_URL=https://api.github.com/graphql
REPO_NAME=<your_repository_name>
REPOSITORY_OWNER=<repository_owner_name>
JSON_FILE_PATH=<path_of_the_json_file>
PROJECT_NUMBER=<your_project_number>
```

Replace the placeholders with your GitHub Personal Access Token, GitHub repository owner, repository name, and the path to your JSON file.
4. Save and close the file.

Now, your application is configured and ready to run!

## Usage
**Configure `.env` File:** Ensure that you have configured the .env file as described in the Configuration section.
## Running the App

**Prepare JSON Data:** Your JSON file should contain an array of objects, where each object represents an issue. For example:
Once you've downloaded the binary, set up your `.env` file, and ensured that a JSON file is present in the same directory, you're ready to run the application.

Here's how you can do it:

1. Open your terminal (Command Prompt for Windows users).
2. Navigate to the directory where your binary and `.env` file are located.
3. Run the application with the following command:

```bash
./gh-issue-creator
```

The application will now read the data from your JSON file, create GitHub issues using the GitHub GraphQL API, and add them to the repository project board.

### JSON File Format

The application requires a JSON file in the same directory as your binary. This file should contain the data for the issues you want to create.

#### Sample JSON File

Here's an updated example of what your JSON file should look like:

```json
[
{
"title": "Sample Issue 1",
"description": "Description of issue 1"
},
{
"title": "Sample Issue 2",
"description": "Description of issue 2"
}
{
"title": "Issue 1",
"description": {
"body": "This is the body of issue 1",
"additional_info": "Additional information for issue 1"
}
},
{
"title": "Issue 2",
"description": {
"body": "This is the body of issue 2",
"additional_info": "Additional information for issue 2"
}
}
]
```
```

Each object in the array represents an issue. The `title` field is the title of the issue, and the `description` field is an object that contains the description of the issue and any additional nested information.

## Contributing

We welcome contributions from everyone. Here's how you can get started:

1. **Fork the Repository**: Start by forking this repository to your own GitHub account.
2. **Clone the Repository**: Next, clone the repository to your local machine so you can start working on it.
3. **Create a New Branch**: Always create a new branch for each feature or fix. This keeps the main branch clean and makes it easier to review and manage contributions.
4. **Make Your Changes**: Now you're ready to make your changes. Whether it's adding a new feature, fixing a bug, or improving documentation, your contributions are always appreciated!
5. **Commit Your Changes**: Once you've made your changes, commit them with a clear and descriptive commit message.
6. **Push Your Changes**: Push your changes to your forked repository on GitHub.
7. **Submit a Pull Request**: Finally, submit a pull request so your changes can be reviewed and merged into the main branch.

Thank you for considering contributing to this project!
Loading