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

Recipe to export Epic Comments to CSV #66

Merged
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
41 changes: 41 additions & 0 deletions .github/workflows/lint-epic-comments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
###
### Workflow that lints code in pull requests
###

name: Lint

# Note: No name so it uses the name associated with the pull request merge to main

on:
pull_request:
paths:
- 'epic-comments/**'

jobs:
lint-epic-comments:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Get Python Version
run: echo "PYTHON_VERSION=$(cat .python-version | grep ^[^#])" >> $GITHUB_ENV

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pipenv"

- name: Install pipenv
run: pip install --user pipenv

- name: Install Python dependencies
working-directory: ./epic-comments
run: make setup-dev

- name: Lint epic-comments with Black linter
working-directory: ./epic-comments
run: make lint
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:

- name: Install Python dependencies
working-directory: ./pivotal-import
run: pipenv install --dev
run: make setup-dev

- name: Lint Python with Black linter
- name: Lint pivotal-import with Black linter
working-directory: ./pivotal-import
run: make lint
41 changes: 41 additions & 0 deletions .github/workflows/test-epic-comments.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
###
### Workflow that test code in pull requests
###

name: Test

# Note: No name so it uses the name associated with the pull request merge to main

on:
pull_request:
paths:
- 'epic-comments/**'

jobs:
test-epic-comments:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out repository code
uses: actions/checkout@v4

- name: Get Python Version
run: echo "PYTHON_VERSION=$(cat .python-version | grep ^[^#])" >> $GITHUB_ENV

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: "pipenv"

- name: Install pipenv
run: pip install --user pipenv

- name: Install Python dependencies
working-directory: ./epic-comments
run: make setup-dev

- name: Test epic-comments
working-directory: ./epic-comments
run: make test
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:

- name: Install Python dependencies
working-directory: ./pivotal-import
run: pipenv install --dev
run: make setup-dev

- name: Test pivotal-import
working-directory: ./pivotal-import
Expand Down
34 changes: 0 additions & 34 deletions Cookbook-Contents.md

This file was deleted.

44 changes: 37 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Welcome to the Shortcut REST API Cookbook

The Shortcut REST API is a powerful tool that can make your work easier and enhance the ways that you use your Shortcut data.
We created this material to get you started using the Shortcut REST API to solve common requests, even if you don't regularly use APIs.

Expand All @@ -13,17 +14,46 @@ Found a typo or other small issue? Please feel free to submit a PR!
Questions and suggestions are welcome as Issues, or send us an email [email protected]. We'd love to hear from you!

## Requirements

All of the cookbook scripts are written in Python 3 and use the [Requests Library](http://docs.python-requests.org/en/master/).
If you're comfortable checking your Python installation, installing Requests, using a virtual environment, and setting environment variables, please jump to [the main table of contents](https://github.com/useshortcut/api-cookbook/blob/master/Cookbook-Contents.md)
If you're comfortable checking your Python installation, installing Requests, using a virtual environment, and setting environment variables, please jump to [the recipes](#cookbook-recipes).

If you'd like a walk-through of getting set up to run these example scripts, please check out the setup instructions:
- [Mac](https://github.com/useshortcut/api-cookbook/blob/master/set-up-instructions.md)
- [PC](https://github.com/useshortcut/api-cookbook/blob/master/windows-set-up-instructions.md)
- [Mac](https://github.com/useshortcut/api-cookbook/blob/main/set-up-instructions.md)
- [PC](https://github.com/useshortcut/api-cookbook/blob/main/windows-set-up-instructions.md)

## Cookbook Recipes

### [Send some Stories to Slack](https://github.com/useshortcut/api-cookbook/tree/main/stories-to-slack)

The support team at Shortcut uses a version of this script to help us get back to customers about bug fixes and shipped features.

[This script](https://github.com/useshortcut/api-cookbook/tree/main/stories-to-slack) searches for work completed between the last business day and today, checks for support tickets on each Story, and preps data to send to Slack. The name of the Story, a link to the Story, and a count of the number of tickets on the Story are sent to a specific Slack channel.

We use this to help the support team quickly find Stories where they need to follow up, but with modifications you could use it for things like daily squad updates, personal reminders, and more.

### [There's incomplete work in my sprint. I need to update all the labels for the next sprint.](https://github.com/useshortcut/api-cookbook/tree/main/change-label)

Many teams use Labels to represent sprints. When there's unfinished work that needs to be rolled into the next sprint, [this script](https://github.com/useshortcut/api-cookbook/tree/main/change-label) can help automate that process. As a bonus, you can also use this script to create labels with custom colors.

### I need to report on cycle time

Cycle time information for Epics and Objectives can be useful reporting tools. These scripts get the cycle time and lead time for an individual Epic or Objective. You can find cycle time information on stories using the charts provided within Shortcut itself.

[How to I get the lead and cycle time for an Objective?](https://github.com/useshortcut/api-cookbook/tree/main/kanban-metrics/objective_metrics.py)

[How do I get the lead and cycle time for an Epic?](https://github.com/useshortcut/api-cookbook/tree/main/kanban-metrics/epic_metrics.py)

### Export Epic Comments to CSV

Export the comments for either a single epic or all epics in your Shortcut Workspace using the [epic-comments recipe](./epic-comments).

## FAQ

## Quick reference to common questions
[How do I get set up to use these scripts on my Mac?](https://github.com/useshortcut/api-cookbook/blob/main/set-up-instructions.md)

[How do I authenticate?](https://github.com/useshortcut/api-cookbook/blob/master/Authentication.md)
[How do I get set up to use these scripts on my PC?](https://github.com/useshortcut/api-cookbook/blob/main/windows-set-up-instructions.md)

[How do I get the next page of results?](https://github.com/useshortcut/api-cookbook/blob/master/Pagination.md)
[How do I authenticate?](https://github.com/useshortcut/api-cookbook/blob/main/Authentication.md)

[Overview of contents](https://github.com/useshortcut/api-cookbook/blob/master/Cookbook-Contents.md)
[How do I get the next page of results?](https://github.com/useshortcut/api-cookbook/blob/main/Pagination.md)
4 changes: 4 additions & 0 deletions epic-comments/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.csv

# Python
.coverage
16 changes: 16 additions & 0 deletions epic-comments/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.PHONY : clean lint setup setup-dev test

clean:
./clean

lint:
./lint

setup:
./setup

setup-dev:
pipenv install --dev

test:
./test
16 changes: 16 additions & 0 deletions epic-comments/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "~=2.31.0"
pyrate-limiter = "~=3.6.0"

[dev-packages]
black = "*"
pytest = "*"
pytest-cov = "*"

[requires]
python_version = "3.10"
Loading
Loading