Skip to content

Commit

Permalink
Given a repository $repoOwner/$repoName, find the id of an issue …
Browse files Browse the repository at this point in the history
…by its `$number`.

Usually users think of "issue #10", but most GitHub GraphQL mutations refer to issues by their id, so you'll find this query quite helpful! For example, you'll need the issue id if you want to [Delete a GitHub issue](GitHubDeleteIssue).


To find the id of issue #3 on the [OneGraph GraphQL Docs Repository](#1), we could pass in the following variables:
  
  ```javascript
  {
    "repoName": "graphql-docs",
    "repoOwner": "OneGraph",
    "number": 3
  }
  ```
  • Loading branch information
sgrove committed Jan 8, 2020
1 parent af6e16a commit 02f7ba6
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions src/examples/GitHubFindIssueIdByNumber.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

---
description: |
Given a repository `$repoOwner`/`$repoName`, find the id of an issue by its `$number`.

Usually users think of "issue #10", but most GitHub GraphQL mutations refer to issues by their id, so you'll find this query quite helpful! For example, you'll need the issue id if you want to [Delete a GitHub issue](GitHubDeleteIssue).


To find the id of issue #3 on the [OneGraph GraphQL Docs Repository](https://github.com/OneGraph/graphql-docs/issues/1), we could pass in the following variables:

```javascript
{
"repoName": "graphql-docs",
"repoOwner": "OneGraph",
"number": 3
}
```

contributedBy: @sgrove
---

```graphql
query GitHubFindIssueIdByNumber(
$repoOwner: String!
$repoName: String!
$number: Int!
) {
gitHub {
repository(owner: $repoOwner, name: $repoName) {
issue(number: $number) {
id
title
}
}
}
}
```

0 comments on commit 02f7ba6

Please sign in to comment.