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

Make README more actionable and test token before starting export #17

Merged
merged 2 commits into from
Apr 26, 2024
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
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@ This shell script will export all of your Shortcut organization data to JSON fil

## Instructions

You'll need a Shortcut API token defined as an environment variable (see below). If you don't have a token already, you can create one by navigating to Settings > My Account > API Tokens.
Download the latest version of this exporter:

```sh
$ export SHORTCUT_API_TOKEN="YOUR API TOKEN HERE"
$ ./exporter.sh
```shell
curl -L -o "exporter.sh" "https://github.com/useshortcut/exporter/raw/main/exporter.sh"
chmod u+x ./exporter.sh
```

Then you'll need a Shortcut API token defined as an environment variable (see below). If you don't have a token already, you can create one by navigating to Settings > My Account > API Tokens.

``` shell
SHORTCUT_API_TOKEN="YOUR API TOKEN HERE" ./exporter.sh
```

## Development
Expand Down
11 changes: 11 additions & 0 deletions exporter.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
#!/bin/sh

APITEST=$(curl --fail -s -X GET \
-H 'Content-Type: application/json' \
-H "Shortcut-Token: $SHORTCUT_API_TOKEN" \
-L "https://api.app.shortcut.com/api/v3/member")

if [ ! "$APITEST" ]
then
echo "[Error] Set the SHORTCUT_API_TOKEN environment variable to a valid Shortcut API token, then run ./exporter.sh again."
exit 1
fi

export DATADIR=./data
mkdir -p "$DATADIR"

Expand Down