6

There are several ways to move a Github issue to a Project board through the GitHub user interface, but there doesn't seem to be any way to do this via the API (either v3 or v4). Is this missing functionality?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Ken Liu
  • 22,503
  • 19
  • 75
  • 98
  • There is an API V4 now (June 2023). See [my edited answer below](https://stackoverflow.com/a/57024538/6309). – VonC Jun 22 '23 at 06:17

1 Answers1

15

2019: You can:

That is:

  • The first one allows you to associate an issue to a project card,

content_id: The issue or pull request id you want to associate with this card. You can use the List issues for a repository and List pull requests endpoints to find this id.
Note: Depending on whether you use the issue id or pull request id, you will need to specify Issue or PullRequest as the content_type.

  • the second one allows you to move a card (and its associated issue)

Those two calls ought to be enough.


The OP Ken Liu asked in the comments if there is any way to add an issue to a project without adding it to a project column.

seth suggests:

You can add an issue to the repo using code (GitHub API) as per creating an issue


2023 (June): since the GitHub CLI gh v2.31.0, you now have a gh project item-add command:

# add an item to monalisa's project "1"
gh project item-add 1 --owner monalisa --url https://github.com/monalisa/myproject/issues/23

Note that, while there is a project REST API v3, pkg/cmd/project/item-add/item_add.go uses GitHub API v4: GraphQL.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Thanks -- did you see any way to add an issue to a project without adding it to a project column? This is the default behavior in the UI but it seems like it's not possible with these API methods. – Ken Liu Jul 14 '19 at 18:54
  • @KenLiu I agree: I did not see that at first glance. – VonC Jul 14 '19 at 19:28
  • You can add an issue to the repo using code as per [creating an issue](https://docs.github.com/en/free-pro-team@latest/rest/reference/issues#create-an-issue) – seth Oct 06 '20 at 19:30
  • 4
    Thank you for this, the endpoint to create a card containing an issue or a pull request is basically undocumented – specifically, the value of `content_type` is nowhere to be found, as far as I can tell. – Benjamin W. Jan 12 '21 at 22:12