cli / cli/cli

`issue create/pr --web --project` should error when project is not usable

Open
#10,704 0 comments 0 reactions 0 assignees View on GitHub
bug gh-issue gh-pr
Dominant language
Go
Stars
46.3k
Forks
9k
Avg merge
2d 9h
Merged PRs (30d)
89

Description

### Describe the bug

**Given** I have a repo `my-org/repo`
**And Given** I have a personal project `williammartin/my-project`
**When** I run `gh issue create --repo "my-org/repo" --title "test" --body "test" --project "my-project" --web`
**Then** I should receive an error that the web view cannot use this project and and an indication that this can only be performed if the issue is submitted via the CLI.

The issue here is that the web view only offers projects that are from the same org, so although the CLI is able to find the right project, and submit it as part of the query parameter, the web view just ignores it.

### Affected version

```
➜ gh version
gh version 2.68.0 (2025-03-05)
https://github.com/cli/cli/releases/tag/v2.68.0
```

### Notes

The CLI loads all known projects from the API here: https://github.com/cli/cli/blob/e30244686c870a552798f6530ebe38e9a158f0ff/api/queries_repo.go#L1255-L1308

And then iterates over them to produce paths used in query params here: https://github.com/cli/cli/blob/e30244686c870a552798f6530ebe38e9a158f0ff/api/queries_repo.go#L809-L823

However, there's no indication of whether the param is actually from a valid selection.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.