<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.xsl" type="text/xsl"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	    xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	     xmlns:dc="http://purl.org/dc/elements/1.1/"
	   xmlns:atom="http://www.w3.org/2005/Atom"
	     xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	  xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>
<channel>
	<title>GraphQL &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/graphql/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Thu, 05 Feb 2026 09:32:45 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>GraphQL &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Get all the reactions to your GitHub content using GraphQL]]></title>
		<link>https://shkspr.mobi/blog/2026/02/get-all-the-reactions-to-your-github-content-using-graphql/</link>
					<comments>https://shkspr.mobi/blog/2026/02/get-all-the-reactions-to-your-github-content-using-graphql/#comments</comments>
				<dc:creator><![CDATA[@edent]]></dc:creator>
		<pubDate>Thu, 05 Feb 2026 12:34:21 +0000</pubDate>
				<category><![CDATA[/etc/]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[GraphQL]]></category>
		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=67577</guid>

					<description><![CDATA[I am both vain and prurient. A combination which makes me fun at parties and a delight to know.  Sometimes when I raise an issue on GitHub, or write a comment, other users leave me Emoji reactions. Perhaps a 👍 or 🎉 if they like my contribution, but occasionally a 👎 or 😕 if they&#039;re foolish enough to think I&#039;m wrong.  The problem is, GitHub doesn&#039;t tell me that someone has 🚀&#039;d my wisdom. If GitHub w…]]></description>
										<content:encoded><![CDATA[<p>I am both vain <em>and</em> prurient. A combination which makes me fun at parties and a delight to know.</p>

<p>Sometimes when I raise an issue on GitHub, or write a comment, other users leave me Emoji reactions. Perhaps a 👍 or 🎉 if they like my contribution, but occasionally a 👎 or 😕 if they're foolish enough to think I'm wrong.</p>

<p>The problem is, GitHub doesn't tell me that someone has 🚀'd my wisdom. If GitHub was as good as Facebook, it would present a little 🔔 to let me know exactly how many ❤️s I have received. Instead I have to manually check every issue I've raised to see if the hive-mind judges me worthy.</p>

<p>You might be thinking that there's an API for finding the reaction count to a specific piece of content - and you'd be right! The only problem is that <a href="https://docs.github.com/en/rest/reactions/reactions?apiVersion=2022-11-28">it requires you to send it a <em>specific</em> content ID</a>. So pretty bloody useless unless you want to construct a mega-query of everything you've ever written.</p>

<p>Enter the terrifying world of <a href="https://docs.github.com/en/graphql">GraphQL</a> - where men fear to tread and AIs are driven mad. It is possible to squeeze the API until the pips squeak. Here's a GraphQL query, run using the <code>gh</code> CLI, which grabs any issue with over zero reactions, displays how many reactions it received, and who gave what sort of reaction.</p>

<pre><code class="language-bash">gh api graphql -f query='
query {
  search(query: "author:@me reactions:&gt;0", type: ISSUE, first: 10) {
    nodes {
      ... on Issue {
        url
        reactions(last: 50) {
          totalCount
          nodes {
            content
            user {
              login
            }
          }
        }
      }
    }
  }
}'
</code></pre>

<p>As you might be able to decipher, that looks for the 10 most recent issues. If you are prolific, you may want to increase that number - although it will increase the time it takes for the query to run. If you have the temerity to dare to retrieve more than 100, you'll be slapped with the dreaded <code>EXCESSIVE_PAGINATION</code> error.</p>

<p>Similarly, it only gets the most recent 50 reactions. The count will be be the total number of reactions, no matter how low you set the number.</p>

<p>In return, you'll get a hideous mass of JavaScript which looks like it has been vomited up by a disgruntled Cacodemon:</p>

<pre><code class="language-json">{
  "data": {
    "search": {
      "nodes": [
       {
          "url": "https://github.com/validator/validator/issues/1814",
          "reactions": {
            "totalCount": 9,
            "nodes": [
              {
                "content": "THUMBS_UP",
                "user": {
                  "login": "markohoza"
                }
              },
              {
                "content": "EYES",
                "user": {
                  "login": "adamwolf"
                }
              },
</code></pre>

<p>There is no way to get anything older. If someone liked a comment you made in 2019, you will <em>never</em> know!</p>

<p>If you hate your eyes enough to read through <a href="https://docs.github.com/en/graphql/reference/enums#searchtype">the search type documentation</a>, you'll notice there is no way to search Pull Requests. This is, of course, a rotten lie. If you read <a href="https://docs.github.com/en/search-github/searching-on-github/searching-issues-and-pull-requests#search-only-issues-or-pull-requests">different documentation</a> you'll see that PRs are classed as a type of issue. Why? Because your sanity is not worth the cost of updating things.</p>

<p>Anyway, it makes our life slightly easier. We can search both Issues and PRs in one easy to chew lump of GraphQL:</p>

<pre><code class="language-bash">gh api graphql -f query='
query {
  search(query: "author:@me reactions:&gt;0", type: ISSUE, first: 100) {
    nodes {
      ... on Issue {
        url
        reactions(last: 100) {
          totalCount
          nodes {
            content
            user {
              login
            }
          }
        }
      }
      ... on PullRequest {
        url
        reactions(last: 100) {
          totalCount
          nodes {
            content
            user {
              login
            }
          }
        }
      }
    }
  }
}'
</code></pre>

<p>Again, beware gazing into the JSON lest the JSON gazes into <em>you!</em></p>

<pre><code class="language-json">{
  "data": {
    "search": {
      "nodes": [
        {
          "url": "https://github.com/WICG/webmonetization/pull/634",
          "reactions": {
            "totalCount": 2,
            "nodes": [
              {
                "content": "CONFUSED",
                "user": {
                  "login": "tomayac"
                }
              },
              {
                "content": "HEART",
                "user": {
                  "login": "tomayac"
                }
              }
            ]
          }
        },
</code></pre>

<p>OK, so it should be pretty damned simple to get the number of reactions to any comments, right? RIGHT?!?!</p>

<p>No. Because consistency is a dirty word and GraphQL was designed in the bowels of hell as a way to keep API developers from ever obtaining a state of grace.</p>

<p>There's no way I could find to use <code>reactions:&gt;0</code> with a comment search query. This will get you lots of useless unreacted results. I guess you can filter them with <code>jq</code> or just scratch your monitor with razor blades so you don't have to see their empty laughing maws.</p>

<pre><code class="language-bash">gh api graphql -f query='
query {
  viewer {
    issueComments(last: 10) {
      nodes {
        url
        reactions(last: 10) {
          totalCount
          nodes {
            content
            user {
              login
            }
          }
        }
      }
    }
  }
}'
</code></pre>

<p>And, again, JSON nested like wheels within wheels and fires within fires:</p>

<pre><code class="language-json">{
  "data": {
    "viewer": {
      "issueComments": {
        "nodes": [
          {
            "url": "https://github.com/home-assistant/supervisor/issues/6474#issuecomment-3740347148",
            "reactions": {
              "totalCount": 0,
              "nodes": []
            }
          },
          {
            "url": "https://github.com/edent/3D-UK-Money/issues/1#issuecomment-3757022146",
            "reactions": {
              "totalCount": 1,
              "nodes": [
                {
                  "content": "THUMBS_UP",
                  "user": {
                    "login": "MickeyF2010"
                  }
                }
              ]
            }
          },
</code></pre>

<h2 id="what-have-we-learned-today"><a href="https://shkspr.mobi/blog/2026/02/get-all-the-reactions-to-your-github-content-using-graphql/#what-have-we-learned-today">What Have We Learned Today?</a></h2>

<p>The Necronomicon was probably written in GraphQL. Any form of Daemon summoning <em>must</em> use nested queries and frightening syntax.</p>

<p>Trying to track reactions to your content <em>will</em> drive you mad. There's a reason this knowledge is forbidden.</p>

<h2 id="disclaimer"><a href="https://shkspr.mobi/blog/2026/02/get-all-the-reactions-to-your-github-content-using-graphql/#disclaimer">Disclaimer</a></h2>

<p>This post was not sponsored by GitHub. Although I did drink rather too many of their free beers at FOSDEM. Consider this post payback for that self-induced hangover.</p>
<img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=67577&HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager">]]></content:encoded>
					
					<wfw:commentRss>https://shkspr.mobi/blog/2026/02/get-all-the-reactions-to-your-github-content-using-graphql/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
