Skip to content
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
40 changes: 27 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,53 @@
![App icon](images/FullSizeIcon.png)

# VersionTwo

Hackathon project: CLI tool to generate static planning view of issues for better team planning

# 🚀 Getting Started
## 📦 Requirements
## 🚀 Getting Started

### 📦 Requirements

The following dependencies are required to run the program:

- Python 3.x
- `brew install python3`
- Python `pyenv` and `pyenv-virtualenv`
- `brew install pyenv pyenv-virtualenv`
- `brew install pyenv pyenv-virtualenv`
- GitHub Command Line Interface (CLI) `gh`
- `brew install gh`

## 💻 Setup
### 💻 Setup

- Authentication through `gh auth login`
- Set the appropriate token permissions: `gh auth refresh --scopes read:project`
- Note: The team must have `read` permissions on the Project Board in order to view the issues on the board.
- Set the `GITHUB_TOKEN` environment variable: `export GITHUB_TOKEN=$(gh auth token)`
- Set the `GITHUB_UNAME` environment variable: `export GITHUB_UNAME=$(gh auth status | grep "(GITHUB_TOKEN)" | cut -d " " -f9)`
- Source the [setup-gh.sh](src/setup-gh.sh) script to configure your gh environment variables

```bash
source src/setup-gh.sh # follow the prompts
```

- Sets the appropriate token scopes: `read: project`.
- Note: The team must have `read` permissions on the Project Board in order to view the issues on the board.
- Sets the `GITHUB_TOKEN` environment variable.
- Sets the `GITHUB_UNAME` environment variable.
- Run `make install` inside the repo directory to configure the appropriate versions of dependencies.

## 🛠 Usage
### 🛠 Usage

To run the main script, change to the current directory of the script, then run:

`python version2.py --output-file "<filename.json>" --temp-dir "<temp.dir>" --include-project <project name>`

See the `--help` menu for full list of filter functionality.

# Background
## Background

GitHub users have issues assigned to themselves or a team they are a member of. These issues can be viewed on a
Project board, which captures the issues in swim lanes. The Project board can only automate with a single organization,
meaning users who work in more than one org do not have a single location to view all issues. This leads to fragmented
planning and execution.

# How does it work?
## How does it work?

```mermaid
%% A · System-Architecture Diagram (≤25 nodes)
Expand All @@ -52,7 +65,8 @@ classDef api fill:#e3f2fd,stroke:#2196f3;
classDef cli fill:#f1f8e9,stroke:#7cb342;
```

# Our Solution
## Our Solution

Our python script will query the GitHub API for all issues associated with the appropriate filters provided to the CLI
tool. The output will be a static HTML page showing all issues in swim lanes. This provides a comprehensive overview
of all issues the team or user has assigned.
of all issues the team or user has assigned.
43 changes: 43 additions & 0 deletions src/setup-gh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#! /usr/bin/env bash

# This script sets up the authentication parameters for the GitHub CLI
# that are needed to run the version2.py script.
# It is assumed that the GitHub CLI is already installed and configured
# on the system.
# The script will update the user's github token to have the needed scopes,
# set the token in the environment and pull in the gh users username as
# another environment variable.

# Exit if not sourced
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
echo "ERROR: This script must be sourced, not executed."
echo "Usage: source ${BASH_SOURCE[0]}"
exit 1
fi

# Check if the GITHUB_TOKEN environment variable is already set
set_gh_token() {
# If not set, set the scopes for the token and set the environment variable
gh auth refresh --scopes read:project

# Set the GITHUB_TOKEN environment variable
export GITHUB_TOKEN=$(gh auth token)
}

Comment thread
rbarker-dev marked this conversation as resolved.
configure_gh_env() {
if [ -n "${GITHUB_TOKEN}" ]; then
echo "GITHUB_TOKEN needs to be unset to update the token scopes."
unset GITHUB_TOKEN
fi

# set the gh_token
set_gh_token

# set the gh_user
export GITHUB_UNAME=$(gh api user --jq .login)

echo "GITHUB_TOKEN is set. Length is: ${#GITHUB_TOKEN}"
echo "GITHUB_UNAME is set to: ${GITHUB_UNAME}"
}

configure_gh_env