Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ce5d26b

Browse filesBrowse files
authored
Merge pull request actions#88 from clarkbw/patch-1
Add a GraphQL example to the README
2 parents eb58336 + 91121b9 commit ce5d26b
Copy full SHA for ce5d26b

File tree

1 file changed

+33
-0
lines changed
Filter options

1 file changed

+33
-0
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+33Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,39 @@ jobs:
179179
console.log(result)
180180
```
181181

182+
### Run custom GraphQL queries
183+
184+
You can use the `github.graphql` object to run custom GraphQL queries against the GitHub API.
185+
186+
```yaml
187+
188+
jobs:
189+
list-packages:
190+
runs-on: ubuntu-latest
191+
steps:
192+
- uses: actions/github-script@v3
193+
with:
194+
github-token: ${{secrets.GITHUB_TOKEN}}
195+
script: |
196+
const query = `query($owner:String!, $name:String!) {
197+
repository(owner:$owner, name:$name){
198+
issues(first:100, labels: [$label]) {
199+
nodes {
200+
id
201+
}
202+
}
203+
}
204+
}`;
205+
const variables = {
206+
owner: context.repo.owner,
207+
name: context.repo.repo,
208+
label: 'wontfix'
209+
}
210+
const result = await github.graphql(query, variables)
211+
console.log(result)
212+
213+
```
214+
182215
_(Note that this particular example only works for a public URL, where the
183216
diff URL is publicly accessible. Getting the diff for a private URL requires
184217
using the API.)_

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.