Skip to content

Commit

Permalink
Support draft PRs (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
schpet authored Jan 15, 2025
1 parent 6d85339 commit 9560e33
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ deno task install

this cli needs three things to work:

1. a linear api key, found at [https://linear.app/settings/api](https://linear.app/settings/api)
2. your current git branch to start with a linear issue id, e.g. `eng-123-my-feature`
3. the directory of your repo to start with a linear team id, e.g. `eng-my-project`
1. a linear api key, found at
[https://linear.app/settings/api](https://linear.app/settings/api)
2. your current git branch to start with a linear issue id, e.g.
`eng-123-my-feature`
3. the directory of your repo to start with a linear team id, e.g.
`eng-my-project`

### required environment variables

Expand All @@ -52,6 +55,7 @@ LINEAR_WORKSPACE="your-company" # your linear.app workspace url slug
add to ~/.bashrc:

```sh
# secrets! make sure this file isn't shared online
export LINEAR_API_KEY="lin_api_..."
export LINEAR_WORKSPACE="your-company"
```
Expand All @@ -64,6 +68,7 @@ export LINEAR_WORKSPACE="your-company"
add to ~/.zshrc:

```sh
# secrets! make sure this file isn't shared online
export LINEAR_API_KEY="lin_api_..."
export LINEAR_WORKSPACE="your-company"
```
Expand All @@ -76,6 +81,7 @@ export LINEAR_WORKSPACE="your-company"
run in terminal:

```sh
# secrets! make sure ~/.config/fish/fish_variables isn't shared online
set -Ux LINEAR_API_KEY "lin_api_..."
set -Ux LINEAR_WORKSPACE "your-company"
```
Expand Down
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"license": "MIT",
"tasks": {
"dev": "deno run --allow-env --allow-sys --allow-run --allow-read --allow-net main.ts",
"install": "deno install --allow-env --allow-sys --allow-run --allow-read --allow-net -c ./deno.json -g -n linear main.ts"
"install": "deno install --allow-env --allow-sys --allow-run --allow-read --allow-net -c ./deno.json -g -n linear ./main.ts"
},
"imports": {
"@cliffy/command": "jsr:@cliffy/command@^1.0.0-rc.7",
Expand Down
8 changes: 6 additions & 2 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ const issueCommand = new Command()
"--base <branch:string>",
"The branch into which you want your code merged",
)
.action(async ({ base }) => {
.option(
"--draft",
"Create the pull request as a draft",
)
.action(async ({ base, draft }) => {
const issueId = await getIssueId();
if (!issueId) {
console.error(
Expand All @@ -266,8 +270,8 @@ const issueCommand = new Command()
`${issueId} ${title}`,
"--body",
url,
"--web",
...(base ? ["--base", base] : []),
...(draft ? ["--draft"] : ["--web"]),
],
stdin: "inherit",
stdout: "inherit",
Expand Down

0 comments on commit 9560e33

Please sign in to comment.