<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jesse Houwing</title>
    <description>The latest articles on DEV Community by Jesse Houwing (@jessehouwing).</description>
    <link>https://dev.to/jessehouwing</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F153902%2F2549a6a6-c745-4d10-b17b-3c8c7651681c.jpg</url>
      <title>DEV Community: Jesse Houwing</title>
      <link>https://dev.to/jessehouwing</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jessehouwing"/>
    <language>en</language>
    <item>
      <title>Dependabot broke after switching to a public npm feed</title>
      <dc:creator>Jesse Houwing</dc:creator>
      <pubDate>Tue, 24 Nov 2026 13:41:36 +0000</pubDate>
      <link>https://dev.to/jessehouwing/dependabot-broke-after-switching-to-a-public-npm-feed-25ce</link>
      <guid>https://dev.to/jessehouwing/dependabot-broke-after-switching-to-a-public-npm-feed-25ce</guid>
      <description>&lt;h2&gt;
  
  
  The problem
&lt;/h2&gt;

&lt;p&gt;We switched a repository to the public, secure package feed for npm. Builds were happy. Dependabot was not. Every run ended with the same error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="no"&gt;GET&lt;/span&gt; &lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="c1"&gt;//&amp;lt;feed proxy&amp;gt;/npm/qs&lt;/span&gt;
&lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;egress&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;allowlisted&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;feed&lt;/span&gt; &lt;span class="n"&gt;proxy&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="mi"&gt;403&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="n"&gt;private_source_authentication_failure&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Dependabot runs in a locked-down proxy. It only talks to hosts it has been explicitly told about, and a registry configured in &lt;code&gt;.npmrc&lt;/code&gt; is not enough. Anything else is blocked with a 403, even if the feed is public.&lt;/p&gt;

&lt;h2&gt;
  
  
  The solution
&lt;/h2&gt;

&lt;p&gt;Declare the feed as a registry in &lt;code&gt;.github/dependabot.yml&lt;/code&gt; and reference it from every npm update entry:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="na"&gt;registries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;public-feed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm-registry&lt;/span&gt;
    &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;https://&amp;lt;feed proxy&amp;gt;/npm/&lt;/span&gt;
    &lt;span class="na"&gt;token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.NPM_FEED_TOKEN }}&lt;/span&gt;
    &lt;span class="na"&gt;replaces-base&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="na"&gt;updates&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;package-ecosystem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"npm"&lt;/span&gt;
    &lt;span class="na"&gt;directory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"/"&lt;/span&gt;
    &lt;span class="na"&gt;registries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="s"&gt;public-feed&lt;/span&gt;
    &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;interval&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"weekly"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Gotcha 1: a public feed still needs a credential
&lt;/h3&gt;

&lt;p&gt;My first attempt, without a token, failed validation: &lt;em&gt;"The property '#/registries/...' of type object did not match one or more of the required schemas"&lt;/em&gt;. The &lt;code&gt;npm-registry&lt;/code&gt; type requires a token, username/password or OIDC, even when the feed needs no authentication. A placeholder value satisfies the schema.&lt;/p&gt;

&lt;h3&gt;
  
  
  Gotcha 2: tokens belong in Dependabot secrets
&lt;/h3&gt;

&lt;p&gt;The token should come from a secret, and it has to be a &lt;strong&gt;Dependabot&lt;/strong&gt; secret, not an Actions secret. No permission to add one in the Settings UI?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkv4l8d8f0e8n1v0rdmxh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkv4l8d8f0e8n1v0rdmxh.png" alt="Dependabot broke after switching to a public npm feed" width="799" height="302"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Depending on your permissions the UI may not be showing the Dependabot Secrets and Variables section.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Given that Actions secrets can often be set using the API or CLI, even when the UI is missing, I hazarded a guess and asked Copilot to try and set the value for me, which succeeded:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuv9ymdllseewk81ltm5n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fuv9ymdllseewk81ltm5n.png" alt="Dependabot broke after switching to a public npm feed" width="800" height="280"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;As expected the API did allow me to set the value anyway.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For your convenience:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"placeholder"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; gh secret &lt;span class="nb"&gt;set&lt;/span&gt; NPM_FEED_TOKEN --app dependabot --repo &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;owner&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;repo&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Take-aways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Switching package feeds means updating Dependabot too, not just &lt;code&gt;.npmrc&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Dependabot's egress allowlist is driven by the &lt;code&gt;registries&lt;/code&gt; block.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm-registry&lt;/code&gt; entries require a credential, even for public feeds.&lt;/li&gt;
&lt;li&gt;Use a Dependabot secret, not an Actions secret.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>github</category>
      <category>supplychainsecurity</category>
    </item>
    <item>
      <title>Protect the repository hosting your GitHub Action (2026)</title>
      <dc:creator>Jesse Houwing</dc:creator>
      <pubDate>Sun, 15 Nov 2026 16:07:37 +0000</pubDate>
      <link>https://dev.to/jessehouwing/protect-the-repository-hosting-your-github-action-2026-4men</link>
      <guid>https://dev.to/jessehouwing/protect-the-repository-hosting-your-github-action-2026-4men</guid>
      <description>&lt;p&gt;A GitHub Action is code that other people run inside their workflows, often with access to a repository token or secrets. That makes the repository hosting your action part of their software supply chain. A compromised maintainer account, workflow or dependency can turn a convenient &lt;code&gt;uses: owner/action@v1&lt;/code&gt; into a way into someone else’s build.&lt;/p&gt;

&lt;p&gt;I wrote the &lt;a href="https://dev.to/xebia/protect-the-repository-hosting-your-github-action-1855"&gt;original version of this post&lt;/a&gt; in 2023. Rulesets, immutable releases and workflow dependency lockfiles give action authors better options now, but they don’t make trust automatic. Here is how I would protect the repository in 2026.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Secure the maintainers
&lt;/h2&gt;

&lt;p&gt;The &lt;a href="https://docs.github.com/en/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication?ref=jessehouwing.net" rel="noopener noreferrer"&gt;author of a GitHub Action should enable two-factor authentication&lt;/a&gt; on every maintainer account. Prefer phishing-resistant methods where available, keep recovery options safe and remove access when it is no longer needed.&lt;/p&gt;

&lt;p&gt;Consider hosting your actions in an organization instead of a personal account. An organization can &lt;a href="https://docs.github.com/en/organizations/keeping-your-organization-secure/managing-two-factor-authentication-for-your-organization/requiring-two-factor-authentication-in-your-organization?ref=jessehouwing.net" rel="noopener noreferrer"&gt;require 2FA&lt;/a&gt; and centralize policies. A verified creator badge can help identify the publisher, but it does not prove that the action’s code is safe.&lt;/p&gt;

&lt;p&gt;Keep the number of people and credentials with write access small. Someone who can change workflows or tags can potentially change what downstream users execute. Prefer contributions from forks and pull requests over granting occasional contributors direct write access.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Limit workflow permissions and outside contributions
&lt;/h2&gt;

&lt;p&gt;In repository settings, set the default &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; permissions to &lt;strong&gt;read repository contents and packages&lt;/strong&gt; , and do not allow workflows to create or approve pull requests unless you have a reviewed reason to do so. Grant additional permissions to individual jobs only when needed. Document the permissions consumers need when they use your action.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F976b908fnfynjsxysou0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F976b908fnfynjsxysou0.png" alt="Protect the repository hosting your GitHub Action (2026)" width="800" height="332"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Restrict default workflow permissions; this example shows organization settings.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Require approval for workflows from outside contributors. The approval policy and fork permissions are distinct: a normal &lt;code&gt;pull_request&lt;/code&gt; from a fork generally receives a read-only token and no repository secrets, so checks that need write access may need a different design. Do not solve that by running untrusted pull request code with a privileged token.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fib1cdt7ndamsso6jwdka.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fib1cdt7ndamsso6jwdka.png" alt="Protect the repository hosting your GitHub Action (2026)" width="799" height="318"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Require approval for workflows from outside contributors; this example shows an organization setting.&lt;/em&gt;&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://github.blog/changelog/2026-09-17-workflow-execution-protections-in-github-actions-generally-available/?ref=jessehouwing.net" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.blog%2Fwp-content%2Fuploads%2F2026%2F09%2F653308119-1cfbe127-7fb9-4458-b69e-253a12abee39.jpeg" height="420" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://github.blog/changelog/2026-09-17-workflow-execution-protections-in-github-actions-generally-available/?ref=jessehouwing.net" rel="noopener noreferrer" class="c-link"&gt;
            Workflow execution protections in GitHub Actions generally available - GitHub Changelog
          &lt;/a&gt;
        &lt;/h2&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.githubassets.com%2Ffavicon.ico" width="32" height="32"&gt;
          github.blog
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Avoid &lt;code&gt;pull_request_target&lt;/code&gt; unless you need its privileged context, and never check out and execute untrusted pull request code in that context. Treat artifacts from untrusted workflows as untrusted too. As of November 2026, GitHub has announced a default policy blocking &lt;code&gt;pull_request_target&lt;/code&gt; in public repositories from December 2, 2026; check the &lt;a href="https://docs.github.com/en/actions/reference/security/securely-using-pull_request_target?ref=jessehouwing.net" rel="noopener noreferrer"&gt;current guidance&lt;/a&gt; before relying on it.&lt;/p&gt;

&lt;p&gt;To block this trigger across your repository, go to &lt;strong&gt;Settings → Actions → Policies&lt;/strong&gt; and create an Actions policy targeting all workflows. Add a &lt;strong&gt;Restrict events&lt;/strong&gt; rule and allow the events your workflows need, but leave &lt;code&gt;pull_request_target&lt;/code&gt; out of the allowlist. Check every event you rely on, including &lt;code&gt;push&lt;/code&gt;, &lt;code&gt;pull_request&lt;/code&gt;, &lt;code&gt;release&lt;/code&gt;, &lt;code&gt;workflow_dispatch&lt;/code&gt; and &lt;code&gt;workflow_call&lt;/code&gt; where relevant: any omitted event is blocked for targeted workflows. Use policy insights and Evaluate mode where available before switching to Active. An explicit policy can protect private repositories too, where supported, and can block the trigger before the public-repository default takes effect. Use organization or enterprise targeting for a broader blanket policy.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://github.blog/changelog/2026-11-02-pull_request_target-blocked-by-default-december-2/?ref=jessehouwing.net" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.blog%2Fwp-content%2Fuploads%2F2026%2F11%2F682988073-439dd4ff-beed-4b9b-b767-acf8c41542d9.jpg" height="420" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://github.blog/changelog/2026-11-02-pull_request_target-blocked-by-default-december-2/?ref=jessehouwing.net" rel="noopener noreferrer" class="c-link"&gt;
            pull_request_target blocked by default December 2 - GitHub Changelog
          &lt;/a&gt;
        &lt;/h2&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.githubassets.com%2Ffavicon.ico" width="32" height="32"&gt;
          github.blog
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  3. Protect release tags and floating tags differently
&lt;/h2&gt;

&lt;p&gt;Create &lt;a href="https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/creating-rulesets-for-a-repository?ref=jessehouwing.net" rel="noopener noreferrer"&gt;tag rulesets&lt;/a&gt; under &lt;strong&gt;Settings → Rules → Rulesets&lt;/strong&gt;. Rulesets use &lt;code&gt;fnmatch&lt;/code&gt;, not regular expressions. For example, &lt;code&gt;v[0-9]*&lt;/code&gt; matches names starting with &lt;code&gt;v&lt;/code&gt; and a digit, including &lt;code&gt;v1&lt;/code&gt; and &lt;code&gt;v10&lt;/code&gt;, without matching &lt;code&gt;verify-sanity&lt;/code&gt;. It also matches other names starting with a digit; test your patterns against your actual tags. &lt;code&gt;*&lt;/code&gt; does not mean “digits only”.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F24datrckmkw2piwln7a2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F24datrckmkw2piwln7a2.png" alt="Protect the repository hosting your GitHub Action (2026)" width="800" height="171"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Create a branch or tag ruleset under repository settings.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I use separate rulesets because a bypass applies to the whole ruleset:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Freeze patch-version tags.&lt;/strong&gt; Target a pattern such as &lt;code&gt;v[0-9]*.*.*&lt;/code&gt;; restrict updates and deletions and block force pushes. Don’t grant a routine bypass. Check your naming scheme, including prerelease tags, before enabling the rule.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restrict creation of patch tags.&lt;/strong&gt; Use a separate ruleset with the same target, restrict creation and grant bypass only to the release identity or repository administrators who actually publish. A release workflow that creates tags needs the right bypass too.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Prevent deletion of floating tags.&lt;/strong&gt; Target the major and minor tags you use, exclude patch tags and restrict deletions without a routine bypass.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Restrict creation and movement of floating tags.&lt;/strong&gt; Use a separate ruleset for those same floating tags, restrict creation and updates, and block force pushes. Allow only your release identity or selected administrators to bypass it: updating an existing floating tag normally requires a force update.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For the floating rules, one possible starting point is include &lt;code&gt;v[0-9]*&lt;/code&gt; and exclude &lt;code&gt;v[0-9]*.*.*&lt;/code&gt;. These are broad glob patterns, not semantic-version validation. Check what they match, including nonstandard names, before turning them on.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2i9y9h7s0m0wr7qbclui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2i9y9h7s0m0wr7qbclui.png" alt="Protect the repository hosting your GitHub Action (2026)" width="800" height="281"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Restrict updates and deletions of patch-version tags.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4yki4m1et0pryci8fzpw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4yki4m1et0pryci8fzpw.png" alt="Protect the repository hosting your GitHub Action (2026)" width="798" height="80"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Prevent deletion of floating tags without a ruleset bypass.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2a3gh9d10nnvc1flc1kj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2a3gh9d10nnvc1flc1kj.png" alt="Protect the repository hosting your GitHub Action (2026)" width="800" height="350"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;A separate floating-tag ruleset can grant a release identity or administrators a bypass.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7g4rhmlw94s1bsxmc4md.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7g4rhmlw94s1bsxmc4md.png" alt="Protect the repository hosting your GitHub Action (2026)" width="800" height="211"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Restrict who can create and move floating version tags.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;These settings are not a substitute for controlling who can change the rulesets themselves. A repository administrator can change or disable them, and bypasses apply to all rules in the same ruleset.&lt;/p&gt;
&lt;h2&gt;
  
  
  4. Publish immutable patch releases
&lt;/h2&gt;

&lt;p&gt;Enable &lt;a href="https://docs.github.com/en/code-security/concepts/supply-chain-security/immutable-releases?ref=jessehouwing.net" rel="noopener noreferrer"&gt;release immutability&lt;/a&gt; in the repository’s general settings. A published immutable release protects its tag and assets from changes and has a release attestation. It does not freeze release notes or other editable release metadata, and it only applies to releases published after the setting is enabled.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://github.blog/changelog/2025-10-28-immutable-releases-are-now-generally-available/?ref=jessehouwing.net" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.blog%2Fwp-content%2Fuploads%2F2025%2F10%2F506112189-347686ae-da68-4633-a150-7c6aca59bd21.jpg" height="420" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://github.blog/changelog/2025-10-28-immutable-releases-are-now-generally-available/?ref=jessehouwing.net" rel="noopener noreferrer" class="c-link"&gt;
            Immutable releases are now generally available - GitHub Changelog
          &lt;/a&gt;
        &lt;/h2&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.githubassets.com%2Ffavicon.ico" width="32" height="32"&gt;
          github.blog
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feh6vqmbnaws19l9bd7op.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feh6vqmbnaws19l9bd7op.png" alt="Protect the repository hosting your GitHub Action (2026)" width="798" height="113"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Release immutability enabled in the example repository.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Use a full version such as &lt;code&gt;v1.2.3&lt;/code&gt; for the immutable release. Build and test the code you intend to ship, create a &lt;strong&gt;draft&lt;/strong&gt; release, attach its assets, and publish only when everything is ready. &lt;code&gt;gh release create&lt;/code&gt; with assets also creates a draft while uploading before it publishes. Don’t plan to replace assets or reuse an immutable release tag to fix a bad release: publish a new patch instead. Review your release automation for operations such as &lt;code&gt;--clobber&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Don’t assume that a protected default branch means every tag points to reviewed code. As the older &lt;a href="https://labs.boostsecurity.io/articles/slsa-dip-at-the-source-of-the-problem/?ref=jessehouwing.net" rel="noopener noreferrer"&gt;SLSA source-control threat analysis&lt;/a&gt; explains, someone who can create a release tag may be able to point it at an unreviewed commit. Restrict tag creation and have the release workflow check that the tagged commit is on the reviewed release branch before publishing. An ancestry check alone can still accept an old, vulnerable commit, so review which commit is being released too. If your build creates a separate release commit, define and verify an equivalent trusted path instead of blindly applying that check.&lt;/p&gt;

&lt;p&gt;The floating tags &lt;code&gt;v1&lt;/code&gt; and, if you support it, &lt;code&gt;v1.2&lt;/code&gt; are separate Git tags. They must &lt;strong&gt;not&lt;/strong&gt; be attached to immutable releases if you intend to move them. After publishing and verifying &lt;code&gt;v1.2.3&lt;/code&gt;, update those floating tags to the same intended commit using the restricted release identity. GitHub’s &lt;a href="https://docs.github.com/en/actions/how-tos/create-and-publish-actions/using-immutable-releases-and-tags-to-manage-your-actions-releases?ref=jessehouwing.net" rel="noopener noreferrer"&gt;immutable releases and tags guide&lt;/a&gt; describes this model.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnde3r9gboiy41zxpeege.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnde3r9gboiy41zxpeege.png" alt="Protect the repository hosting your GitHub Action (2026)" width="800" height="104"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;An immutable gh-actions-lock release.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;An immutable release protects what was published, not whether the code was safe when you published it. If an attacker can publish a new release or move a floating tag, they can still affect users who follow that new reference. Review the release, limit who can publish, and protect the floating tags too.&lt;/p&gt;

&lt;p&gt;You can check the release attestation and its recorded commit before reviewing or using a release:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh release verify v1.2.3 -R OWNER/ACTION-REPOSITORY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This is an explicit check; GitHub Actions does not run it automatically for everyone consuming &lt;code&gt;uses:&lt;/code&gt; references.&lt;/p&gt;

&lt;p&gt;If you publish from a workflow, use a protected &lt;a href="https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments?ref=jessehouwing.net" rel="noopener noreferrer"&gt;release environment&lt;/a&gt;, restrict which tags can deploy and require a reviewer where appropriate. Prevent self-review when you have another reviewer. For a solo maintainer that may not be possible, so be explicit about the tradeoff. An environment gates jobs that use it; it does not prevent a user or token with repository write access from publishing through the Releases API.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm37a7ltfz2zfmixcay55.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm37a7ltfz2zfmixcay55.png" alt="Protect the repository hosting your GitHub Action (2026)" width="800" height="713"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The example release environment allows self-review because it has only one reviewer.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;You can also limit who can trigger your publication workflows with an Actions policy. In &lt;strong&gt;Settings → Actions → Policies&lt;/strong&gt; , create a separate policy, target the release workflow paths and enable &lt;strong&gt;Restrict actors&lt;/strong&gt;. In my example, the path pattern &lt;code&gt;.github/workflows/*release*&lt;/code&gt; targets matching release workflows and the allowed actor is the &lt;strong&gt;Repository admin&lt;/strong&gt; role. Use exact paths or patterns that cover every workflow that can publish, and protect the policy and workflow changes themselves. Use Evaluate mode where available and check policy insights before enforcing it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs7v9theehmqthdtrjg97.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fs7v9theehmqthdtrjg97.png" alt="Protect the repository hosting your GitHub Action (2026)" width="800" height="408"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;An example actor policy targets release workflow paths and permits repository administrators.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The rule restricts the actor who triggers a matching workflow; it does not restrict the job's token or prevent someone with sufficient permissions from publishing through the API or another workflow. Make sure required automation identities are allowed, or their runs may be blocked. GitHub's built-in feature processes are exempt, but your own workflows triggered by a bot may still need that bot explicitly allowed. Keep tag protections and the release environment as separate safeguards.&lt;/p&gt;

&lt;p&gt;For JavaScript actions, test the actual bundled output and ensure the committed distribution matches the source and lockfile. For composite or Docker actions, review what the published &lt;code&gt;action.yml&lt;/code&gt; invokes. If you publish binaries or other assets, consider generating &lt;a href="https://docs.github.com/en/actions/how-tos/secure-your-work/use-artifact-attestations/use-artifact-attestations?ref=jessehouwing.net" rel="noopener noreferrer"&gt;build attestations&lt;/a&gt; and document how consumers can verify them. A release attestation and build provenance answer different questions; neither proves the source is benign.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://github.blog/changelog/2024-06-25-artifact-attestations-is-generally-available/?ref=jessehouwing.net" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.blog%2Fwp-content%2Fthemes%2Fgithub-2021-child%2Fdist%2Fimg%2Fsocial-v3-new-releases.jpg" height="421" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://github.blog/changelog/2024-06-25-artifact-attestations-is-generally-available/?ref=jessehouwing.net" rel="noopener noreferrer" class="c-link"&gt;
            Artifact Attestations is generally available - GitHub Changelog
          &lt;/a&gt;
        &lt;/h2&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.githubassets.com%2Ffavicon.ico" width="32" height="32"&gt;
          github.blog
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



&lt;h2&gt;
  
  
  5. Protect branches and release code
&lt;/h2&gt;

&lt;p&gt;Protect the default branch with a branch ruleset: require pull requests, meaningful tests and security checks, block force pushes and deletion, and require code-owner review for sensitive files when independent reviewers are available. Review workflows, &lt;code&gt;action.yml&lt;/code&gt;, lockfiles and release scripts as carefully as the rest of the action.&lt;/p&gt;

&lt;p&gt;Where a team can provide independent review, dismiss stale approvals when the pull request changes and consider requiring approval of the most recent reviewable push. That addresses the risk of adding unreviewed changes after approval; it does not prevent an inattentive or compromised reviewer from approving malicious code. Avoid giving automation identities a way to both introduce and approve changes or bypass required review.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;CODEOWNERS&lt;/code&gt; is useful for ownership and review requests, but its configuration lives in the repository. For eligible organization-owned repositories, the &lt;a href="https://github.blog/changelog/2026-02-17-required-reviewer-rule-is-now-generally-available/?ref=jessehouwing.net" rel="noopener noreferrer"&gt;required reviewer rule&lt;/a&gt; can require a specified number of approvals from designated teams for matching paths. An organization-level ruleset can cover workflows, action definitions, lockfiles, release scripts and &lt;code&gt;CODEOWNERS&lt;/code&gt; across repositories without relying on each repository’s &lt;code&gt;CODEOWNERS&lt;/code&gt; file. That makes the requirement harder to remove for an attacker who controls only one repository, provided they cannot modify or bypass the organization rule or control its team. Required teams need write access or higher; review their membership, path patterns and the bypass list. Set at least one required approval: zero requests review but does not require approval. The rule complements &lt;code&gt;CODEOWNERS&lt;/code&gt;, and it is not available on personal repositories without teams.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://github.blog/changelog/2026-02-17-required-reviewer-rule-is-now-generally-available/?ref=jessehouwing.net" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.blog%2Fwp-content%2Fuploads%2F2026%2F02%2F549552308-e856eb6f-6b1b-47b9-b50b-0cbf582e4280.jpg" height="420" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://github.blog/changelog/2026-02-17-required-reviewer-rule-is-now-generally-available/?ref=jessehouwing.net" rel="noopener noreferrer" class="c-link"&gt;
            Required reviewer rule is now generally available - GitHub Changelog
          &lt;/a&gt;
        &lt;/h2&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.githubassets.com%2Ffavicon.ico" width="32" height="32"&gt;
          github.blog
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdxpk1iv11a4kv8ghabxl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdxpk1iv11a4kv8ghabxl.png" alt="Protect the repository hosting your GitHub Action (2026)" width="800" height="1573"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Required status checks in the example default-branch ruleset.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Require your own real check names and confirm they run on every relevant pull request; a required check skipped by a path filter can leave a pull request blocked.&lt;/p&gt;

&lt;p&gt;For a solo-maintainer repository, an approval from another code owner may not be possible. Choose a recovery and bypass policy deliberately. A &lt;strong&gt;pull-request-only&lt;/strong&gt; admin bypass preserves a PR trail but permits an administrator to bypass checks when merging; it is not equivalent to independent review.&lt;/p&gt;

&lt;p&gt;Consider a separate branch ruleset preventing creation or updates of version-like branches if your project reserves names such as &lt;code&gt;v1&lt;/code&gt; for tags. Use a pattern such as &lt;code&gt;v[0-9]*&lt;/code&gt; and test it against your branch names. This avoids ambiguous version names; don’t rely on a blanket claim about how every API or resolver handles a branch and tag with the same name.&lt;/p&gt;

&lt;p&gt;Signed commits can be another layer where maintainers can protect and rotate their keys. A verified badge shows a signature is valid for a registered key; it doesn’t prove the account, private key or review process is trustworthy. I discuss the limits in &lt;a href="https://dev.to/jessehouwing/the-use-or-uselessness-of-signed-commits-27e9"&gt;The use or uselessness of signed commits&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;
  
  
  6. Turn on GitHub’s security features
&lt;/h2&gt;

&lt;p&gt;Enable &lt;a href="https://docs.github.com/en/code-security/secret-scanning/introduction/about-secret-scanning?ref=jessehouwing.net" rel="noopener noreferrer"&gt;secret scanning and push protection&lt;/a&gt;, Dependabot alerts and security updates, and &lt;a href="https://docs.github.com/en/code-security/code-scanning/introduction-to-code-scanning/about-code-scanning?ref=jessehouwing.net" rel="noopener noreferrer"&gt;code scanning&lt;/a&gt;. Configure CodeQL for GitHub Actions as well as the languages used by your action when supported. Add required code-scanning results to the branch ruleset after analysis is running, and use dependency review on pull requests.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx6f05jopqoos0mh6mvhs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx6f05jopqoos0mh6mvhs.png" alt="Protect the repository hosting your GitHub Action (2026)" width="800" height="170"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Enable secret scanning and push protection.&lt;/em&gt;&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://github.blog/changelog/2024-03-11-secret-scanning-and-push-protection-are-enabled-by-default-on-new-public-repositories/?ref=jessehouwing.net" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.blog%2Fwp-content%2Fthemes%2Fgithub-2021-child%2Fdist%2Fimg%2Fsocial-v3-new-releases.jpg" height="421" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://github.blog/changelog/2024-03-11-secret-scanning-and-push-protection-are-enabled-by-default-on-new-public-repositories/?ref=jessehouwing.net" rel="noopener noreferrer" class="c-link"&gt;
            Secret scanning and push protection are enabled by default on new public repositories - GitHub Changelog
          &lt;/a&gt;
        &lt;/h2&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.githubassets.com%2Ffavicon.ico" width="32" height="32"&gt;
          github.blog
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2w3hk579jnlqwfaa5j7c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2w3hk579jnlqwfaa5j7c.png" alt="Protect the repository hosting your GitHub Action (2026)" width="640" height="810"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;CodeQL default configuration for GitHub Actions and Go in the example repository.&lt;/em&gt;&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://github.blog/changelog/2025-04-22-github-actions-workflow-security-analysis-with-codeql-is-now-generally-available/?ref=jessehouwing.net" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.blog%2Fwp-content%2Fthemes%2Fgithub-2021-child%2Fdist%2Fimg%2Fsocial-v3-new-releases.jpg" height="421" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://github.blog/changelog/2025-04-22-github-actions-workflow-security-analysis-with-codeql-is-now-generally-available/?ref=jessehouwing.net" rel="noopener noreferrer" class="c-link"&gt;
            GitHub Actions workflow security analysis with CodeQL is now generally available - GitHub Changelog
          &lt;/a&gt;
        &lt;/h2&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.githubassets.com%2Ffavicon.ico" width="32" height="32"&gt;
          github.blog
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Check availability and billing for your repository and account, especially before enabling paid features such as Code Quality. A dashboard is useful, but a check enforced on the pull request can stop a problem before it reaches a release.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://github.blog/changelog/2024-04-30-code-scanning-now-allows-configuring-rulesets-to-prevent-pull-requests-from-being-merged-beta/?ref=jessehouwing.net" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.blog%2Fwp-content%2Fthemes%2Fgithub-2021-child%2Fdist%2Fimg%2Fsocial-v3-new-releases.jpg" height="421" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://github.blog/changelog/2024-04-30-code-scanning-now-allows-configuring-rulesets-to-prevent-pull-requests-from-being-merged-beta/?ref=jessehouwing.net" rel="noopener noreferrer" class="c-link"&gt;
            Code scanning now allows configuring rulesets to prevent pull requests from being merged (beta) - GitHub Changelog
          &lt;/a&gt;
        &lt;/h2&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.githubassets.com%2Ffavicon.ico" width="32" height="32"&gt;
          github.blog
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;


&lt;p&gt;Enable Dependabot version updates for GitHub Actions and every package ecosystem your action actually uses. For a JavaScript action, that includes npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="na"&gt;updates&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;package-ecosystem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;github-actions&lt;/span&gt;
    &lt;span class="na"&gt;directory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/&lt;/span&gt;
    &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;interval&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;weekly&lt;/span&gt;
  &lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="na"&gt;package-ecosystem&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm&lt;/span&gt;
    &lt;span class="na"&gt;directory&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/&lt;/span&gt;
    &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;interval&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;weekly&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Review the updates and their lockfile and bundled-output changes. Configure a cooldown where it suits your threat model, while still promptly handling security updates.&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://github.blog/changelog/2025-07-01-dependabot-supports-configuration-of-a-minimum-package-age/?ref=jessehouwing.net" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.blog%2Fwp-content%2Fthemes%2Fgithub-2021-child%2Fdist%2Fimg%2Fsocial-v3-improvements.jpg" height="421" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://github.blog/changelog/2025-07-01-dependabot-supports-configuration-of-a-minimum-package-age/?ref=jessehouwing.net" rel="noopener noreferrer" class="c-link"&gt;
            Dependabot supports configuration of a minimum package age - GitHub Changelog
          &lt;/a&gt;
        &lt;/h2&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.githubassets.com%2Ffavicon.ico" width="32" height="32"&gt;
          github.blog
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhff136quraoqobn12ifb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhff136quraoqobn12ifb.png" alt="Protect the repository hosting your GitHub Action (2026)" width="780" height="417"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Dependabot security settings.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  7. Prefer short-lived, narrowly scoped credentials
&lt;/h2&gt;

&lt;p&gt;Start with &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; and the minimum permissions for the job. For cloud resources, use &lt;a href="https://docs.github.com/en/actions/concepts/security/openid-connect?ref=jessehouwing.net" rel="noopener noreferrer"&gt;OIDC&lt;/a&gt; when supported instead of a long-lived cloud secret. Where automation needs access outside the repository token’s scope, consider a GitHub App installation token limited to the required repositories and permissions.&lt;/p&gt;

&lt;p&gt;If you need a personal access token, prefer a fine-grained token with an expiration and only the repositories and permissions required. Rotate exposed credentials immediately. Organization SSO and token policies can add protection where available, but don’t replace least privilege.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F89c5f2wlcdynmyrhwrwn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F89c5f2wlcdynmyrhwrwn.png" alt="Protect the repository hosting your GitHub Action (2026)" width="792" height="288"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Scope fine-grained tokens to only the repositories they need.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  8. Lock the actions your own workflows use
&lt;/h2&gt;

&lt;p&gt;Your action repository consumes actions too. A direct &lt;code&gt;uses: owner/action@v1&lt;/code&gt; can move, and pinning a composite action to a SHA does not by itself pin the other actions that composite action calls. Review and minimize the dependencies in the release path.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://docs.github.com/en/actions/concepts/security/workflow-dependency-lockfiles?ref=jessehouwing.net" rel="noopener noreferrer"&gt;Workflow dependency lockfiles&lt;/a&gt; record the commit and repository identity for action dependencies, including supported transitive action dependencies. GitHub runs the locked commit for onboarded workflows. You can keep readable version references in workflow files while reviewing the lockfile diff:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh extension install github/gh-actions-lock
gh actions-lock
gh actions-lock --verify
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Review the tool and its release before installing it. The generator can rewrite &lt;code&gt;uses:&lt;/code&gt; references as well as the lockfile, so review the entire diff. Commit &lt;code&gt;.github/workflows/actions.lock&lt;/code&gt;, update it when workflows change, and make verification a required pull request check. Dependabot can update entries for already-onboarded workflows; it does not automatically onboard a new workflow.&lt;/p&gt;

&lt;p&gt;The lockfile is not a universal build lock. It does not pin reusable workflows called at the job level; pin those references to a full commit SHA and make sure the called repository has its own lockfile. It also does not lock arbitrary scripts, container image contents, package downloads, inputs, secrets or runner images. Local &lt;code&gt;./&lt;/code&gt; actions run from the checked-out workspace; see &lt;a href="https://docs.github.com/en/actions/how-tos/secure-your-work/lock-workflow-dependencies?ref=jessehouwing.net#generate-the-lockfile" rel="noopener noreferrer"&gt;GitHub’s local-action guidance&lt;/a&gt; before migrating them to &lt;code&gt;$/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After onboarding and verifying the targeted workflows, enable the &lt;strong&gt;Require lockfile&lt;/strong&gt; workflow execution protection. It can block targeted workflows that are not onboarded, including workflows without action dependencies. Check reusable workflows and rollout scope first. An onboarded lockfile also satisfies GitHub’s separate SHA-pinning policy; if you can’t use a lockfile, pin actions to full commit SHAs, verify their source and review updates instead.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftt1640p1rpp519ke89pm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftt1640p1rpp519ke89pm.png" alt="Protect the repository hosting your GitHub Action (2026)" width="800" height="244"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Require lockfile is not active in the example repository.&lt;/em&gt;&lt;/p&gt;


&lt;div class="crayons-card c-embed text-styles text-styles--secondary"&gt;
    &lt;div class="c-embed__content"&gt;
        &lt;div class="c-embed__cover"&gt;
          &lt;a href="https://github.blog/changelog/2026-10-28-github-actions-workflow-lockfiles-are-generally-available/?ref=jessehouwing.net" class="c-link align-middle" rel="noopener noreferrer"&gt;
            &lt;img alt="" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.blog%2Fwp-content%2Fuploads%2F2026%2F11%2F680321168-9c7a77aa-f5e2-4c65-a8ac-26742dcb2a72.jpg" height="420" class="m-0" width="800"&gt;
          &lt;/a&gt;
        &lt;/div&gt;
      &lt;div class="c-embed__body"&gt;
        &lt;h2 class="fs-xl lh-tight"&gt;
          &lt;a href="https://github.blog/changelog/2026-10-28-github-actions-workflow-lockfiles-are-generally-available/?ref=jessehouwing.net" rel="noopener noreferrer" class="c-link"&gt;
            GitHub Actions workflow lockfiles are generally available - GitHub Changelog
          &lt;/a&gt;
        &lt;/h2&gt;
        &lt;div class="color-secondary fs-s flex items-center"&gt;
            &lt;img alt="favicon" class="c-embed__favicon m-0 mr-2 radius-0" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.githubassets.com%2Ffavicon.ico" width="32" height="32"&gt;
          github.blog
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;For a broader walkthrough of workflow protections, see &lt;a href="https://dev.to/jessehouwing/keep-the-creepy-crawlies-out-of-you-workflows-securing-github-actions-in-2026-2np0"&gt;Keep the creepy crawlies out of your workflows&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Reduce dependencies without creating new risks
&lt;/h2&gt;

&lt;p&gt;I previously replaced an automatic-release action with a short script. That removed a dependency, but force-moving a &lt;code&gt;latest&lt;/code&gt; tag and publishing directly is not a good default for an immutable-release process. Fewer dependencies help only if the replacement is still reviewed, least-privileged and safe.&lt;/p&gt;

&lt;p&gt;Keep release workflows small, review every action that receives a token or secret, and pin or lock the actions you keep. Don’t interpolate untrusted issue or pull request text directly into shell scripts. Pass it through environment variables and quote it, as described in GitHub’s &lt;a href="https://docs.github.com/en/actions/reference/security/secure-use?ref=jessehouwing.net" rel="noopener noreferrer"&gt;secure use reference&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  10. Keep version pointers correct
&lt;/h2&gt;

&lt;p&gt;If &lt;code&gt;v1&lt;/code&gt; still points to &lt;code&gt;v1.0.0&lt;/code&gt; after you’ve shipped &lt;code&gt;v1.0.5&lt;/code&gt;, users of &lt;code&gt;@v1&lt;/code&gt; won’t receive the fixes. If &lt;code&gt;v1&lt;/code&gt; points to the wrong commit, they may run code you never intended to release. After every release, check that your floating major and optional minor tags point to the latest compatible &lt;strong&gt;published stable&lt;/strong&gt; patch.&lt;/p&gt;

&lt;p&gt;My earlier post used the Actions SemVer Checker. Its successor, &lt;a href="https://github.com/jessehouwing/gh-actions-version?ref=jessehouwing.net" rel="noopener noreferrer"&gt;gh-actions-version&lt;/a&gt;, can verify version tags and release configuration:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh extension install jessehouwing/gh-actions-version
gh actions-version verify -R OWNER/ACTION-REPOSITORY
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Review and verify the extension you install, and choose a release or commit you trust. Configure the tool for the tag and branch conventions your action actually uses. Prerelease status is taken from the GitHub Release, not inferred from a tag suffix; the tool doesn’t support suffixes such as &lt;code&gt;-beta&lt;/code&gt;. Verification is a useful check, but protect the identity that can move tags and make sure the release job actually uses it.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical starting point
&lt;/h2&gt;

&lt;p&gt;For most action repositories, I would start with 2FA and limited maintainers; read-only workflow defaults; protected default branches with real tests and scanning; immutable patch releases; separately protected floating tags; a reviewed release identity; and locked, verified workflow dependencies.&lt;/p&gt;

&lt;p&gt;None of these settings replaces a secure action. Review how your action handles inputs, tokens and secrets, and keep untrusted pull request code away from privileged workflows. GitHub Security Lab’s guidance on &lt;a href="https://securitylab.github.com/research/github-actions-preventing-pwn-requests/?ref=jessehouwing.net" rel="noopener noreferrer"&gt;preventing pwn requests&lt;/a&gt;, &lt;a href="https://securitylab.github.com/research/github-actions-untrusted-input/?ref=jessehouwing.net" rel="noopener noreferrer"&gt;untrusted input&lt;/a&gt; and &lt;a href="https://securitylab.github.com/research/github-actions-building-blocks/?ref=jessehouwing.net" rel="noopener noreferrer"&gt;trusting your building blocks&lt;/a&gt; is still worth reading.&lt;/p&gt;

&lt;p&gt;Let’s build a more secure Actions ecosystem together!&lt;/p&gt;

</description>
      <category>githubactions</category>
      <category>github</category>
      <category>security</category>
    </item>
    <item>
      <title>Protect the repository behind your GitHub CLI extension</title>
      <dc:creator>Jesse Houwing</dc:creator>
      <pubDate>Sun, 15 Nov 2026 15:27:50 +0000</pubDate>
      <link>https://dev.to/jessehouwing/protect-the-repository-behind-your-github-cli-extension-1j8i</link>
      <guid>https://dev.to/jessehouwing/protect-the-repository-behind-your-github-cli-extension-1j8i</guid>
      <description>&lt;p&gt;A &lt;a href="https://docs.github.com/en/github-cli/github-cli/creating-github-cli-extensions?ref=jessehouwing.net" rel="noopener noreferrer"&gt;GitHub CLI extension&lt;/a&gt; is just a repository, but users install and run its code with a single command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ gh extension install github/gh-actions-lock
✓ Installed extension github/gh-actions-lock
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That makes the repository’s release process part of your users’ software supply chain. GitHub does not certify third-party extensions, and the CLI does not verify an extension’s release assets or attestations when installing them. A few repository settings can make a compromised account or workflow much less useful to an attacker.&lt;/p&gt;

&lt;p&gt;The recommendations below focus on extensions distributed with versioned releases. The key distinction from a GitHub Action is that &lt;code&gt;gh&lt;/code&gt; &lt;a href="https://docs.github.com/en/github-cli/github-cli/using-github-cli-extensions?ref=jessehouwing.net" rel="noopener noreferrer"&gt;installs a binary from the latest release&lt;/a&gt;, or clones the default branch for a script extension. It does not use movable major or minor tags as automatic update channels.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Secure the accounts that can publish
&lt;/h2&gt;

&lt;p&gt;Turn on two-factor authentication for every maintainer account. If you publish from an organization, enforce it there and keep the number of people with write access small.&lt;/p&gt;

&lt;p&gt;Prefer contributions through forks and pull requests over adding occasional contributors as collaborators. Anyone with write access can create, edit, or delete releases; that can expose users to a replaced binary even if the source tag itself has not changed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fib1cdt7ndamsso6jwdka.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fib1cdt7ndamsso6jwdka.png" alt="Protect the repository behind your GitHub CLI extension" width="799" height="318"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Require approval for workflows from outside contributors; this example shows an organization setting.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you need a token for automation, use a fine-grained personal access token scoped to only the repositories it needs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F89c5f2wlcdynmyrhwrwn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F89c5f2wlcdynmyrhwrwn.png" alt="Protect the repository behind your GitHub CLI extension" width="792" height="288"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Scope fine-grained tokens to only the repositories they need.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  2. Protect the default branch
&lt;/h2&gt;

&lt;p&gt;For script extensions, the default branch is the code users get when they install or upgrade. &lt;a href="https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-rulesets/available-rules-for-rulesets?ref=jessehouwing.net" rel="noopener noreferrer"&gt;Protect it&lt;/a&gt; like a production release channel:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Require changes to go through pull requests.&lt;/li&gt;
&lt;li&gt;Require the relevant tests and checks before merging.&lt;/li&gt;
&lt;li&gt;Require code-owner review for sensitive files, such as release workflows.&lt;/li&gt;
&lt;li&gt;Block force pushes and branch deletion.&lt;/li&gt;
&lt;li&gt;Keep bypass permissions limited to the people who need them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For a solo-maintainer project, choose a bypass policy deliberately: a rule that nobody can bypass may make recovery difficult, while a broad bypass list weakens the protection.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F24datrckmkw2piwln7a2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F24datrckmkw2piwln7a2.png" alt="Protect the repository behind your GitHub CLI extension" width="800" height="171"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Create a branch or tag ruleset under repository settings.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdxpk1iv11a4kv8ghabxl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdxpk1iv11a4kv8ghabxl.png" alt="Protect the repository behind your GitHub CLI extension" width="800" height="1573"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The example default-branch ruleset. Its named checks are demonstration no-ops.&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Optional: require signed commits
&lt;/h3&gt;

&lt;p&gt;You can add &lt;strong&gt;Require signed commits&lt;/strong&gt; to the default-branch ruleset. This works best in enterprise setups, where signing keys can be issued, stored, rotated and revoked centrally, for example on hardware tokens or through a managed key vault. For a personal repository, only turn it on if you can keep your signing keys secure on every device you commit from.&lt;/p&gt;

&lt;p&gt;Don’t treat a (verified) badge as proof of trust. As explained in &lt;a href="https://dev.to/jessehouwing/the-use-or-uselessness-of-signed-commits-27e9"&gt;The use or uselessness of signed commits&lt;/a&gt;, it shows that the signature is valid and belongs to a key registered on the account. It does &lt;strong&gt;not&lt;/strong&gt; tell you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;whether the account was compromised,&lt;/li&gt;
&lt;li&gt;whether the private key was stored securely,&lt;/li&gt;
&lt;li&gt;whether the account is the one you expected (&lt;code&gt;octocat&lt;/code&gt; or &lt;code&gt;0ctocat&lt;/code&gt;?),&lt;/li&gt;
&lt;li&gt;whether the account still belongs to the same person,&lt;/li&gt;
&lt;li&gt;whether the signer reviewed what they signed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A verified commit is only as trustworthy as the account and key behind it. Unless you can verify the state of the account owner’s account, it is not a trust signal on its own. Use signed commits as an extra layer, alongside pull requests, required checks and protected releases, not as a replacement for them.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4w0k79cqe84mgshs986r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4w0k79cqe84mgshs986r.png" alt="Protect the repository behind your GitHub CLI extension" width="800" height="60"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The optional Require signed commits rule, shown selected for illustration.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  3. Lock down version tags
&lt;/h2&gt;

&lt;p&gt;Use a tag ruleset for patch-version tags, such as &lt;code&gt;v*.*.*&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Restrict updates.&lt;/li&gt;
&lt;li&gt;Restrict deletions.&lt;/li&gt;
&lt;li&gt;Block force pushes.&lt;/li&gt;
&lt;li&gt;Restrict creation to repository administrators or the release automation identity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This keeps a published version name from silently moving to a different commit. It also narrows who can mint a new version. GitHub rulesets apply to matching tag names; test your release workflow with the creation restriction before relying on it, since creating a release may create its tag as part of the same operation.&lt;/p&gt;

&lt;p&gt;There is no need to add separate protections for floating major or minor tags as an extension update mechanism: &lt;code&gt;gh&lt;/code&gt; does not follow them automatically. Keep the ruleset focused on the exact version tags that identify releases.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdpqhbh7t3l6vmj7tdwnf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdpqhbh7t3l6vmj7tdwnf.png" alt="Protect the repository behind your GitHub CLI extension" width="800" height="530"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;A ruleset targeting version tags.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2i9y9h7s0m0wr7qbclui.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2i9y9h7s0m0wr7qbclui.png" alt="Protect the repository behind your GitHub CLI extension" width="800" height="281"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Restrict version tag updates and deletions.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgf4c8aldroo3xo0x1rzz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgf4c8aldroo3xo0x1rzz.png" alt="Protect the repository behind your GitHub CLI extension" width="798" height="83"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Block force pushes to version tags.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fscmyresuuax3r90ftbtl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fscmyresuuax3r90ftbtl.png" alt="Protect the repository behind your GitHub CLI extension" width="799" height="437"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Restrict version tag creation.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fktfojiwazcb74tz5p75l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fktfojiwazcb74tz5p75l.png" alt="Protect the repository behind your GitHub CLI extension" width="798" height="134"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Allow repository administrators to bypass the creation restriction.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  4. Enable immutable releases
&lt;/h2&gt;

&lt;p&gt;Turn on &lt;a href="https://docs.github.com/en/code-security/concepts/supply-chain-security/immutable-releases?ref=jessehouwing.net" rel="noopener noreferrer"&gt;release immutability&lt;/a&gt; in the repository’s release settings. Once published, an immutable release’s assets and associated tag cannot be changed. GitHub also creates a release attestation that records the tag, commit, and assets.&lt;/p&gt;

&lt;p&gt;Immutability only applies to releases published after the setting is enabled. It is the strongest protection against someone replacing a release asset while leaving its tag untouched.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feh6vqmbnaws19l9bd7op.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feh6vqmbnaws19l9bd7op.png" alt="Protect the repository behind your GitHub CLI extension" width="798" height="113"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Release immutability enabled in the example repository.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnde3r9gboiy41zxpeege.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fnde3r9gboiy41zxpeege.png" alt="Protect the repository behind your GitHub CLI extension" width="800" height="104"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;An immutable gh-actions-lock release.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Remember that immutability is not a substitute for limiting write access. Release metadata such as the title, notes, prerelease status, and which release is marked latest can still be changed.&lt;/p&gt;
&lt;h2&gt;
  
  
  5. Publish only after the release is complete
&lt;/h2&gt;

&lt;p&gt;Build and upload every asset before publishing the release:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a draft release.&lt;/li&gt;
&lt;li&gt;Upload the platform binaries and checksums.&lt;/li&gt;
&lt;li&gt;Generate and attach build provenance.&lt;/li&gt;
&lt;li&gt;Publish the release.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This ordering is important because immutable releases cannot accept asset changes after publication. Check that your release action supports this sequence; some actions publish immediately or use &lt;code&gt;--clobber&lt;/code&gt; when a release already exists.&lt;/p&gt;

&lt;p&gt;Use a &lt;a href="https://docs.github.com/en/actions/reference/workflows-and-actions/deployments-and-environments?ref=jessehouwing.net" rel="noopener noreferrer"&gt;release environment&lt;/a&gt; restricted to version tags if you want an additional approval gate. Keep release credentials in that environment, require review where appropriate, and prevent self-review. An environment gates the workflow job, however; it does not stop someone with repository write access from using the Releases API directly.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm37a7ltfz2zfmixcay55.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fm37a7ltfz2zfmixcay55.png" alt="Protect the repository behind your GitHub CLI extension" width="800" height="713"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The example release environment allows self-review because it has only one reviewer.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  6. Generate provenance and make verification usable
&lt;/h2&gt;

&lt;p&gt;If your build uses GitHub Actions, generate artifact attestations for the binaries. Grant only the release job the permissions it needs, typically &lt;code&gt;contents: write&lt;/code&gt;, &lt;code&gt;id-token: write&lt;/code&gt;, and &lt;code&gt;attestations: write&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Document how users can &lt;a href="https://docs.github.com/en/code-security/how-tos/secure-your-supply-chain/secure-your-dependencies/verify-release-integrity?ref=jessehouwing.net" rel="noopener noreferrer"&gt;verify a downloaded asset&lt;/a&gt;. Here is what that looks like for &lt;code&gt;github/gh-actions-lock&lt;/code&gt;, which publishes immutable, attested releases. First, check that the release itself is intact:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gh release verify v0.4.1 -R github/gh-actions-lock
Resolved tag v0.4.1 to sha1:a8846ab4e4c1e34a7c40f65f2e78e98066913bf0
Loaded attestation from GitHub API
✓ Release v0.4.1 verified!

Assets
darwin-amd64 sha256:4ef64599440398999f184321d5237df131721434901ecaaf3da6aa018bdd1f8f
darwin-arm64 sha256:f205ea5dbbda67165e08aab1fb6395290ca62f0a038bf27d4b684abd0816635c
linux-amd64 sha256:39deb2fe714dbf74b073d8245fc7f3d50cd0eee18d5c0900e9e849ae933ae17e
windows-amd64.exe sha256:d3582b58f907c145d673f5f31ebfa21a6570df04f3aca9cce667d129a3c607dc
...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then download an asset and check it is the one listed in the release attestation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ gh release download v0.4.1 -R github/gh-actions-lock -p linux-amd64

$ gh release verify-asset v0.4.1 ./linux-amd64 -R github/gh-actions-lock
Calculated digest &lt;span class="k"&gt;for&lt;/span&gt; linux-amd64: sha256:39deb2fe714dbf74b073d8245fc7f3d50cd0eee18d5c0900e9e849ae933ae17e
Resolved tag v0.4.1 to sha1:a8846ab4e4c1e34a7c40f65f2e78e98066913bf0
Loaded attestation from GitHub API

✓ Verification succeeded! linux-amd64 is present &lt;span class="k"&gt;in&lt;/span&gt; release v0.4.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, check the build provenance to see which workflow built it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gh attestation verify ./linux-amd64 --repo github/gh-actions-lock
Loaded digest sha256:39deb2fe714dbf74b073d8245fc7f3d50cd0eee18d5c0900e9e849ae933ae17e for file://linux-amd64
Loaded 1 attestation from GitHub API

The following policy criteria will be enforced:
- Predicate type must match:................ https://slsa.dev/provenance/v1
- Source Repository Owner URI must match:... https://github.com/github
- Source Repository URI must match:......... https://github.com/github/gh-actions-lock
- Subject Alternative Name must match regex: (?i)^https://github\.com/github/gh-actions-lock/
- OIDC Issuer must match:................... https://token.actions.githubusercontent.com

✓ Verification succeeded!

The following 1 attestation matched the policy criteria

- Attestation #1
  - Build repo:..... github/gh-actions-lock
  - Build workflow:. .github/workflows/release.yml@refs/tags/v0.4.1
  - Signer repo:.... github/gh-actions-lock
  - Signer workflow: .github/workflows/release.yml@refs/tags/v0.4.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A release that was published without immutability has no release attestation, so the first check fails:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gh release verify v0.0.3 -R jessehouwing/gh-actions-version
no attestations for tag v0.0.3 (sha1:465c543411c0831b7d3b64111a229c982028eb43)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are explicit checks for maintainers and users. &lt;code&gt;gh extension install&lt;/code&gt; does not perform them automatically, so provenance is most useful when you explain how to validate it.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Side note: verifying an extension before you install or upgrade it&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;gh extension install&lt;/code&gt; and &lt;code&gt;gh extension upgrade&lt;/code&gt; download a release asset without checking it, and you can’t make &lt;code&gt;gh&lt;/code&gt; install a file you verified yourself. You can, however, check the release before you install it. The easiest way is &lt;a href="https://github.com/mrecachinas/gh-verify-download?ref=jessehouwing.net" rel="noopener noreferrer"&gt;&lt;code&gt;gh verify-download&lt;/code&gt;&lt;/a&gt;, an extension by Michael Recachinas. It checks that the release is immutable and that the asset has build provenance &lt;em&gt;before&lt;/em&gt; it downloads anything, and shows which workflow, commit and ref built it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;$ gh extension install mrecachinas/gh-verify-download
✓ Installed extension mrecachinas/gh-verify-download

$ gh release view -R github/gh-actions-lock --json tagName -q .tagName
v0.4.1

$ gh verify-download v0.4.1 -R github/gh-actions-lock -p linux-amd64
github/gh-actions-lock v0.4.1
✓ Immutable release, verified by GitHub&lt;span class="s1"&gt;'s signed release attestation

linux-amd64
✓ Listed in the signed release attestation
✓ Verified SLSA build provenance
  - Build instructions: https://github.com/github/gh-actions-lock/blob/04b7a1a4d00b339dd3ff903bb4d78d4066b2bac7/.github/workflows/release.yml
  - Source: https://github.com/github/gh-actions-lock/tree/04b7a1a4d00b339dd3ff903bb4d78d4066b2bac7
  - Source ref: refs/tags/v0.4.1
  - Build run: https://github.com/github/gh-actions-lock/actions/runs/41504210203/attempts/1
  - Runner: github-hosted

$ gh extension install github/gh-actions-lock --pin v0.4.1
✓ Installed extension github/gh-actions-lock
✓ Pinned extension at v0.4.1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use the asset name for your platform with &lt;code&gt;-p&lt;/code&gt;, for example &lt;code&gt;windows-amd64.exe&lt;/code&gt; or &lt;code&gt;darwin-arm64&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A release without immutability still shows its build provenance, but warns you that the assets can be replaced:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gh verify-download v0.0.3 -R jessehouwing/gh-actions-version -p linux-amd64
jessehouwing/gh-actions-version v0.0.3
! Not an immutable release; assets can be replaced after publishing

linux-amd64
✓ Verified SLSA build provenance
  - Build instructions: https://github.com/jessehouwing/gh-actions-version/blob/465c543411c0831b7d3b64111a229c982028eb43/.github/workflows/release.yml
  - Source: https://github.com/jessehouwing/gh-actions-version/tree/465c543411c0831b7d3b64111a229c982028eb43
  - Source ref: refs/tags/v0.0.3
  - Build run: https://github.com/jessehouwing/gh-actions-version/actions/runs/43714922719/attempts/1
  - Runner: github-hosted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You don’t need to know the publisher’s workflow up front. The tool shows you which workflow signed the provenance, so you can judge whether it looks right. If any check fails, it asks before downloading (defaulting to No) or exits with an error in scripts.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gh verify-download&lt;/code&gt; is a binary extension itself. Its releases are immutable and attested, so its README shows how to check it with itself, or you can check its first release with &lt;code&gt;gh release verify&lt;/code&gt; and &lt;code&gt;gh attestation verify&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;A few things to keep in mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pin the tag you checked.&lt;/strong&gt; Without &lt;code&gt;--pin&lt;/code&gt;, &lt;code&gt;gh&lt;/code&gt; looks up the latest release again at install time, which may not be the one you checked. Pinning is only safe if the release is immutable; otherwise its assets can still change after your check.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Make sure you got a binary.&lt;/strong&gt; &lt;code&gt;gh&lt;/code&gt; decides between binary and script install from the &lt;em&gt;latest&lt;/em&gt; release, even when you pin. If the installed extension has no &lt;code&gt;manifest.yml&lt;/code&gt;, it was cloned instead; treat it as a script extension.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Upgrading a pinned extension.&lt;/strong&gt; Check the new tag, run &lt;code&gt;gh extension remove example&lt;/code&gt;, then install with &lt;code&gt;--pin&lt;/code&gt; again. Don’t rely on &lt;code&gt;install --pin --force&lt;/code&gt; on an already-installed extension, because it currently ignores the pin (cli/cli#13551). A plain &lt;code&gt;gh extension upgrade&lt;/code&gt; installs whatever is latest without checking it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No attestation is still an answer.&lt;/strong&gt; If the release isn’t immutable or has no provenance, you can still choose to install. Just know you’re trusting the maintainer’s account and process, not a verifiable build.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Script extensions can’t be checked this way.&lt;/strong&gt; They are cloned from the repository rather than downloaded from a release. Review the code, and pin to a commit SHA with &lt;code&gt;--pin &amp;lt;sha&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;gh verify-download&lt;/code&gt; behaves like the &lt;code&gt;gh release download --verify&lt;/code&gt; flag proposed in &lt;a href="https://github.com/cli/cli/issues/14789?ref=jessehouwing.net" rel="noopener noreferrer"&gt;cli/cli#14789&lt;/a&gt; (draft PR &lt;a href="https://github.com/cli/cli/pull/14783?ref=jessehouwing.net" rel="noopener noreferrer"&gt;cli/cli#14783&lt;/a&gt;). If you’d like this built into &lt;code&gt;gh&lt;/code&gt;, upvote that issue.&lt;/p&gt;

&lt;h2&gt;
  
  
  7. Reduce the risk in release automation
&lt;/h2&gt;

&lt;p&gt;Workflows that publish binaries have powerful permissions. Keep those permissions scoped to the release job, default other workflows to read-only access, and do not allow Actions to create or approve pull requests unless the project requires it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F976b908fnfynjsxysou0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F976b908fnfynjsxysou0.png" alt="Protect the repository behind your GitHub CLI extension" width="800" height="332"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Restrict default workflow permissions; this example shows organization settings.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Avoid unnecessary dependencies in the release path, and lock the ones you keep with a lock file. Lock files replace commit SHA pins in your workflow files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Generate &lt;code&gt;.github/workflows/actions.lock&lt;/code&gt; with&lt;/strong&gt; &lt;a href="https://github.com/github/gh-actions-lock?ref=jessehouwing.net" rel="noopener noreferrer"&gt;&lt;strong&gt;&lt;code&gt;gh actions-lock&lt;/code&gt;&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;.&lt;/strong&gt; Keep readable version references such as &lt;code&gt;@v2.2.0&lt;/code&gt; in &lt;code&gt;uses:&lt;/code&gt;; the lock file records the commit behind each one, &lt;em&gt;including the actions that composite actions call&lt;/em&gt;. That matters here: &lt;code&gt;cli/gh-extension-precompile&lt;/code&gt; is a composite action that runs &lt;code&gt;actions/setup-go&lt;/code&gt; and &lt;code&gt;actions/attest-build-provenance&lt;/code&gt; internally. A SHA pin on &lt;code&gt;gh-extension-precompile&lt;/code&gt; doesn’t pin those; the lock file does. Because the workflow files keep version numbers, Dependabot can still raise security alerts for them, which it can’t do for SHA pins.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Keep the lock file current and checked.&lt;/strong&gt; Dependabot regenerates the lock entry when it bumps an action, and a cooldown (&lt;code&gt;cooldown: default-days: 7&lt;/code&gt;) keeps you from being among the first to pull in a compromised release. Add a workflow that runs &lt;code&gt;gh actions-lock --verify&lt;/code&gt; on pull requests and make it a required status check, so a stale or tampered lock file can’t be merged. GitHub’s own &lt;a href="https://github.com/github/gh-actions-lock/blob/main/.github/workflows/verify-lockfile.yml?ref=jessehouwing.net" rel="noopener noreferrer"&gt;&lt;code&gt;verify-lockfile.yml&lt;/code&gt;&lt;/a&gt; is a good starting point. Review lock-file diffs: a changed SHA means the code your release runs has changed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Turn on the&lt;/strong&gt; &lt;a href="https://docs.github.com/en/actions/how-tos/administer/enforce-workflow-lockfiles?ref=jessehouwing.net" rel="noopener noreferrer"&gt;&lt;strong&gt;“Require lockfile” Actions policy&lt;/strong&gt;&lt;/a&gt; &lt;strong&gt;.&lt;/strong&gt; Under Settings → Actions → Policies, a workflow execution protection can block any targeted workflow that isn’t covered by the lock file. That stops a pushed or edited workflow, for example the release workflow, from running unlocked code. It’s available at repository level, also for personal repositories. &lt;strong&gt;Evaluate&lt;/strong&gt; mode is only available on GitHub Enterprise Cloud, so elsewhere run &lt;code&gt;gh actions-lock --verify&lt;/code&gt; first and then go straight to &lt;strong&gt;Active&lt;/strong&gt;. The policy only covers step-level &lt;code&gt;uses:&lt;/code&gt;; reusable workflows from other repositories must be onboarded to a lock file in their own repository.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Optionally restrict allowed actions.&lt;/strong&gt; An allow-list of the actions you actually use adds defence in depth. If you previously required SHA pins, switch to the lock file and the “Require lockfile” policy instead.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftt1640p1rpp519ke89pm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftt1640p1rpp519ke89pm.png" alt="Protect the repository behind your GitHub CLI extension" width="800" height="244"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Workflow execution protection options. Require lockfile is not active in the example repository.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;For a broader overview of these Actions protections, see &lt;a href="https://dev.to/jessehouwing/keep-the-creepy-crawlies-out-of-you-workflows-securing-github-actions-in-2026-2np0"&gt;Keep the creepy crawlies out of your workflows&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Running the check locally shows what the required check will catch. Here it also flags a container image that a lock file can’t pin:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ gh actions-lock --verify
Scanning 5 workflows
container image ghcr.io/ossf/scorecard-action:v2.5.0 is not pinned by digest
↳ used by .github\workflows\scorecard.yml: ossf/scorecard-action@v2.5.0
↳ the lockfile pins action commits, not container images; ask the maintainer of ossf/scorecard-action@v2.5.0 to pin it by digest
↳ https://github.com/github/gh-actions-lock/blob/main/docs/troubleshooting.md#container-image
All 5 workflows valid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  8. Turn on the free security features
&lt;/h2&gt;

&lt;p&gt;Public repositories get most of GitHub Advanced Security at no cost, so there is little reason to leave these off:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.github.com/en/code-security/secret-scanning/introduction/about-secret-scanning?ref=jessehouwing.net" rel="noopener noreferrer"&gt;&lt;strong&gt;Secret scanning and push protection.&lt;/strong&gt;&lt;/a&gt; Secret scanning finds credentials that were already committed. Push protection blocks new ones before they reach the repository. A leaked token with write access is exactly what an attacker needs to publish a rogue release.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx6f05jopqoos0mh6mvhs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fx6f05jopqoos0mh6mvhs.png" alt="Protect the repository behind your GitHub CLI extension" width="800" height="170"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Enable secret scanning and push protection.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://docs.github.com/en/code-security/code-scanning/introduction-to-code-scanning/about-code-scanning?ref=jessehouwing.net" rel="noopener noreferrer"&gt;&lt;strong&gt;Code scanning with CodeQL.&lt;/strong&gt;&lt;/a&gt; The default setup takes a few clicks and analyses both your code and your workflows. The GitHub Actions analysis flags risky patterns such as untrusted input in &lt;code&gt;run:&lt;/code&gt; steps and overly broad &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; permissions, which are a common way into a release pipeline.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2w3hk579jnlqwfaa5j7c.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F2w3hk579jnlqwfaa5j7c.png" alt="Protect the repository behind your GitHub CLI extension" width="640" height="810"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;CodeQL default configuration for GitHub Actions and Go.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dependabot alerts, security updates and version updates.&lt;/strong&gt; Configure version updates for every ecosystem you use, such as &lt;code&gt;gomod&lt;/code&gt; and &lt;code&gt;github-actions&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhff136quraoqobn12ifb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhff136quraoqobn12ifb.png" alt="Protect the repository behind your GitHub CLI extension" width="780" height="417"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Dependabot security settings.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Dependency review.&lt;/strong&gt; It shows vulnerable or newly added dependencies in pull requests before they are merged.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Make these checks part of your default-branch ruleset rather than just dashboards:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add &lt;strong&gt;Require code scanning results&lt;/strong&gt; , so pull requests with new high-severity alerts can’t be merged.&lt;/li&gt;
&lt;li&gt;Add the dependency-review check as a required status check.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faggtt7vwd54psal3lmfl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Faggtt7vwd54psal3lmfl.png" alt="Protect the repository behind your GitHub CLI extension" width="800" height="227"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Require CodeQL results in the default-branch ruleset.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;These features can catch problems before they ship in a release; check feature availability and billing for your account.&lt;/p&gt;

&lt;h2&gt;
  
  
  9. Keep releases predictable
&lt;/h2&gt;

&lt;p&gt;Use one consistent version-tag format, such as &lt;code&gt;v1.2.3&lt;/code&gt;, and ensure the release marked latest is actually the newest stable version. &lt;code&gt;gh&lt;/code&gt; compares release tag names to detect binary updates; it does not use semantic-version ordering to decide which release is newer.&lt;/p&gt;

&lt;p&gt;Keep generated executables out of the source tree. Apart from making reviews harder, a root-level executable with the extension’s name can affect how the CLI treats the repository.&lt;/p&gt;

&lt;h2&gt;
  
  
  A practical baseline
&lt;/h2&gt;

&lt;p&gt;For most binary or script extensions, start with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;2FA and a small set of trusted maintainers.&lt;/li&gt;
&lt;li&gt;Pull-request and status-check protection on the default branch, optionally with required signed commits.&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;v*.*.*&lt;/code&gt; tag ruleset that blocks updates, deletions, and force pushes, with restricted creation.&lt;/li&gt;
&lt;li&gt;Immutable releases, published only after assets and provenance are ready.&lt;/li&gt;
&lt;li&gt;A release workflow with minimal permissions and an environment gate if approvals are needed.&lt;/li&gt;
&lt;li&gt;An &lt;code&gt;actions.lock&lt;/code&gt; file covering every workflow, including composite actions’ dependencies, verified on every pull request as a required check and enforced with the “Require lockfile” Actions policy.&lt;/li&gt;
&lt;li&gt;Secret scanning, push protection, CodeQL code scanning and Dependabot, plus Code Quality where available; check eligibility and billing, and enforce available scanning and quality checks through the default-branch ruleset.&lt;/li&gt;
&lt;li&gt;Clear instructions for users to verify release assets and attestations.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The goal is not to make publishing impossible. It is to make the trusted path clear, limit who can change it, and prevent a published version from becoming a different program without users noticing.&lt;/p&gt;

</description>
      <category>github</category>
      <category>githubactions</category>
      <category>security</category>
      <category>supplychainsecurity</category>
    </item>
    <item>
      <title>Cleaning up unaffiliated users in GitHub Enterprise Cloud with the GraphQL API</title>
      <dc:creator>Jesse Houwing</dc:creator>
      <pubDate>Thu, 05 Nov 2026 21:16:54 +0000</pubDate>
      <link>https://dev.to/jessehouwing/cleaning-up-unaffiliated-users-in-github-enterprise-cloud-with-the-graphql-api-1527</link>
      <guid>https://dev.to/jessehouwing/cleaning-up-unaffiliated-users-in-github-enterprise-cloud-with-the-graphql-api-1527</guid>
      <description>&lt;p&gt;GitHub added the concept of &lt;a href="https://github.blog/changelog/2025-10-28-unaffiliated-users-for-ghec-accounts-now-generally-available/?ref=jessehouwing.net" rel="noopener noreferrer"&gt;unaffiliated users for GHEC accounts a while ago&lt;/a&gt;. Enterprise members who don't belong to any organization now show up as &lt;em&gt;unaffiliated&lt;/em&gt;, and the changelog suggests that you can "create automation using our remove enterprise member GraphQL API". This is required even if you have SCIM configured at the organization level, because SCIM never touches enterprise membership itself. But what the changelog, however, doesn't tell you &lt;em&gt;how&lt;/em&gt; to remove these users using the GraphQL API.&lt;/p&gt;

&lt;p&gt;This post shows how to do exactly that with the GitHub CLI.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: On Enterprise Managed Users (EMU) and ghe.com enterprises the mutation is rejected with &lt;code&gt;FORBIDDEN&lt;/code&gt;, so manage those users through your identity provider&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;GitHub CLI (&lt;code&gt;gh&lt;/code&gt;) authenticated as an enterprise owner&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A regular GitHub Enterprise Cloud enterprise.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The &lt;code&gt;admin:enterprise&lt;/code&gt; and &lt;code&gt;read:user&lt;/code&gt; token scopes:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 1: List the unaffiliated users
&lt;/h2&gt;

&lt;p&gt;Unaffiliated users don't consume a license, so they don't appear in the &lt;code&gt;consumed-licenses&lt;/code&gt; REST endpoint. Query them through GraphQL instead, using the &lt;code&gt;UNAFFILIATED&lt;/code&gt; membership role:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight graphql"&gt;&lt;code&gt;&lt;span class="n"&gt;gh&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt; &lt;span class="n"&gt;graphql&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;paginate&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;my&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;enterprise&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'
query($e: String!, $endCursor: String) {
  enterprise(slug: $e) {
    id
    members(first: 100, after: $endCursor, role: UNAFFILIATED) {
      totalCount
      pageInfo { hasNextPage endCursor }
      nodes {
        ... on User { id login }
        ... on EnterpriseUserAccount { id login user { id } }
      }
    }
  }
}'&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note the &lt;code&gt;user { id }&lt;/code&gt; on &lt;code&gt;EnterpriseUserAccount&lt;/code&gt;: the mutation below needs the ID of the underlying &lt;code&gt;User&lt;/code&gt;, not the enterprise account.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Decide who to keep
&lt;/h2&gt;

&lt;p&gt;Removing everybody is rarely what you want. Before removing someone, consider excluding:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;members of an enterprise team (&lt;code&gt;GET /enterprises/{enterprise}/teams&lt;/code&gt; and &lt;code&gt;/teams/{slug}/memberships&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;users with a Copilot seat (&lt;code&gt;GET /enterprises/{enterprise}/copilot/billing/seats&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;a hand-picked list of protected accounts&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 3: Remove the user
&lt;/h2&gt;

&lt;p&gt;Use the &lt;code&gt;removeEnterpriseMember&lt;/code&gt; mutation with the enterprise ID and the user ID:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh api graphql &lt;span class="sb"&gt;`
  -f query='mutation($e: ID!, $u: ID!) {
    removeEnterpriseMember(input: { enterpriseId: $e, userId: $u }) { clientMutationId }
  }' `&lt;/span&gt;
  -f &lt;span class="nv"&gt;e&lt;/span&gt;&lt;span class="o"&gt;=&amp;lt;&lt;/span&gt;enterprise-id&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; -f &lt;span class="nv"&gt;u&lt;/span&gt;&lt;span class="o"&gt;=&amp;lt;&lt;/span&gt;user-id&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 4: Always dry-run first
&lt;/h2&gt;

&lt;p&gt;Putting steps 1–3 together, save the following as &lt;code&gt;remove-unaffiliated-users.ps1&lt;/code&gt;. It needs PowerShell 7 and &lt;code&gt;gh&lt;/code&gt;, and it only prints what it would do when you pass &lt;code&gt;-DryRun&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="k"&gt;param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;Parameter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Mandatory&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$ProtectedUsers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; @&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="k"&gt;switch&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$DryRun&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;$ErrorActionPreference&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Stop"&lt;/span&gt;

&lt;span class="c1"&gt;# Step 1: all unaffiliated members (gh follows the cursor with --paginate)&lt;/span&gt;
&lt;span class="nv"&gt;$query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; @&lt;span class="s1"&gt;'
query($e: String!, $endCursor: String) {
  enterprise(slug: $e) {
    id
    members(first: 100, after: $endCursor, role: UNAFFILIATED) {
      pageInfo { hasNextPage endCursor }
      nodes {
        ... on User { id login }
        ... on EnterpriseUserAccount { id login user { id } }
      }
    }
  }
}
'&lt;/span&gt;@
&lt;span class="nv"&gt;$pages&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gh&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt; &lt;span class="n"&gt;graphql&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;paginate&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;slurp&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$query&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;ConvertFrom&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Json&lt;/span&gt;
&lt;span class="nv"&gt;$enterpriseId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$pages&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;enterprise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;
&lt;span class="nv"&gt;$members&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$pages&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;ForEach&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Object&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nv"&gt;$_&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;enterprise&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;members&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;nodes&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Step 2: logins to keep&lt;/span&gt;
&lt;span class="nv"&gt;$keep&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Collections&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Generic&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;HashSet&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$ProtectedUsers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nc"&gt;StringComparer&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;OrdinalIgnoreCase&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;$teams&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gh&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt; &lt;span class="s2"&gt;"/enterprises/$Enterprise/teams"&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;paginate&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;ConvertFrom&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Json&lt;/span&gt;
&lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$team&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;$teams&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;gh&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt; &lt;span class="s2"&gt;"/enterprises/$Enterprise/teams/$($team.slug)/memberships"&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;paginate&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
        &lt;span class="nc"&gt;ConvertFrom&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Json&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;ForEach&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Object&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$keep&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;login&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="n"&gt;gh&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt; &lt;span class="s2"&gt;"/enterprises/$Enterprise/copilot/billing/seats"&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;paginate&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;jq&lt;/span&gt; &lt;span class="s1"&gt;'.seats[].assignee.login'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="k"&gt;ForEach&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Object&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;void&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$keep&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Step 3: remove everybody else&lt;/span&gt;
&lt;span class="nv"&gt;$mutation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; @&lt;span class="s1"&gt;'
mutation($e: ID!, $u: ID!) {
  removeEnterpriseMember(input: { enterpriseId: $e, userId: $u }) {
    clientMutationId
  }
}
'&lt;/span&gt;@
&lt;span class="k"&gt;foreach&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$member&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nv"&gt;$members&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$keep&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$member&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;login&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Write&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="s2"&gt;"Keeping $($member.login)"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$DryRun&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Write&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="s2"&gt;"[DRY RUN] Would remove $($member.login)"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="nv"&gt;$userId&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;$member&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="nv"&gt;$member&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="c1"&gt;# EnterpriseUserAccount wraps a User&lt;/span&gt;
    &lt;span class="n"&gt;gh&lt;/span&gt; &lt;span class="n"&gt;api&lt;/span&gt; &lt;span class="n"&gt;graphql&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$mutation&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$enterpriseId&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$userId&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;Out&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="kc"&gt;Null&lt;/span&gt;
    &lt;span class="nc"&gt;Write&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Host&lt;/span&gt; &lt;span class="s2"&gt;"Removed $($member.login)"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run it twice: preview first, then for real.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;remove&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;unaffiliated&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ps1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Enterprise&lt;/span&gt; &lt;span class="n"&gt;my&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;enterprise&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;DryRun&lt;/span&gt;
&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;remove&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;unaffiliated&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ps1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Enterprise&lt;/span&gt; &lt;span class="n"&gt;my&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;enterprise&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;ProtectedUsers&lt;/span&gt; &lt;span class="n"&gt;admin&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;bot&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Afterwards, re-run the step 1 query: &lt;code&gt;totalCount&lt;/code&gt; should be &lt;code&gt;0&lt;/code&gt;. In our testing the count still showed the removed users right after the call and dropped to &lt;code&gt;0&lt;/code&gt; about 20 seconds later, so wait a moment before concluding that a removal failed.&lt;/p&gt;

&lt;p&gt;To keep the list at zero, run the script on a schedule from a GitHub Actions workflow, using a token with the &lt;code&gt;admin:enterprise&lt;/code&gt; scope stored as a secret.&lt;/p&gt;

&lt;h2&gt;
  
  
  Optional: remove users in batches
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;removeEnterpriseMember&lt;/code&gt; accepts a single user, but GraphQL lets you send several aliased mutations in one request. Replace the removal loop in the script with this to remove users 20 at a time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$toRemove&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; @&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$members&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;Where&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nc"&gt;Object&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="nv"&gt;$keep&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$_&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;login&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;$retry&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; @&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$start&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt; &lt;span class="nv"&gt;$toRemove&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$start&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;$batchMembers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; @&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$toRemove&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$start&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;math&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$start&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;$toRemove&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Count&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;# One aliased mutation per user, each with its own variable ($u0, $u1, ...)&lt;/span&gt;
    &lt;span class="nv"&gt;$variables&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt; &lt;span class="nv"&gt;$batchMembers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;"`$u${i}: ID!"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nv"&gt;$fields&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$i&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;lt&lt;/span&gt; &lt;span class="nv"&gt;$batchMembers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        @&lt;span class="s2"&gt;"
  m${i}: removeEnterpriseMember(input: { enterpriseId: `$e, userId: `$u${i} }) {
    clientMutationId
  }
"&lt;/span&gt;@
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="nv"&gt;$query&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"mutation(`$e: ID!, $($variables -join ', ')) {`n$($fields -join "&lt;/span&gt;&lt;span class="sb"&gt;`n")`&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;"

    $ghArgs = @("&lt;/span&gt;&lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="s2"&gt;", "&lt;/span&gt;&lt;span class="n"&gt;graphql&lt;/span&gt;&lt;span class="s2"&gt;", "&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;", "&lt;/span&gt;&lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$query&lt;/span&gt;&lt;span class="s2"&gt;", "&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;", "&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$enterpriseId&lt;/span&gt;&lt;span class="s2"&gt;")
    for ($i = 0; $i -lt $batchMembers.Count; $i++) {
        $ghArgs += @("&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="s2"&gt;", "&lt;/span&gt;&lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$($batchMembers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="nv"&gt;$batchMembers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;")
    }

    # gh exits non-zero when any alias fails, but still prints the response, so capture it either way
    $response = gh @ghArgs 2&amp;gt;$null | ConvertFrom-Json

    for ($i = 0; $i -lt $batchMembers.Count; $i++) {
        $failure = $response.errors | Where-Object { $_.path[0] -eq "&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;" }
        if ($failure) {
            Write-Host "&lt;/span&gt;&lt;span class="nc"&gt;Failed&lt;/span&gt; &lt;span class="nv"&gt;$($batchMembers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;login&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nv"&gt;$($failure&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"
            $retry += $batchMembers[$i]
        } else {
            Write-Host "&lt;/span&gt;&lt;span class="nc"&gt;Removed&lt;/span&gt; &lt;span class="nv"&gt;$($batchMembers&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;login&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"
        }
    }
}

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Keep batches small (10–25). The mutations run one after another on the server, so batching saves round trips rather than time, and very large batches can trigger GitHub's secondary rate limits.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reading the errors
&lt;/h3&gt;

&lt;p&gt;A batch can partly succeed. The response then contains both a &lt;code&gt;data&lt;/code&gt; object and an &lt;code&gt;errors&lt;/code&gt; array:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"data"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"m0"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"clientMutationId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;//&lt;/span&gt; &lt;span class="n"&gt;succeeded&lt;/span&gt;
    &lt;span class="nl"&gt;"m1"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="err"&gt;//&lt;/span&gt; &lt;span class="n"&gt;failed&lt;/span&gt;
    &lt;span class="nl"&gt;"m2"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;"clientMutationId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="err"&gt;//&lt;/span&gt; &lt;span class="n"&gt;succeeded&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"errors"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"NOT_FOUND"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"m1"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Could not resolve to a node with the global id of 'U_kgDOAAAAAA'."&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a real response from a batch of three: two real unaffiliated users (&lt;code&gt;m0&lt;/code&gt;, &lt;code&gt;m2&lt;/code&gt;) and one made-up ID (&lt;code&gt;m1&lt;/code&gt;). The two real users were removed, the made-up ID failed, and &lt;code&gt;gh&lt;/code&gt; exited with code 1 because &lt;code&gt;errors&lt;/code&gt; was present. The full response is still printed, so capture it either way. The response may also contain an &lt;code&gt;extensions.warnings&lt;/code&gt; block with ID deprecation notices; ignore it, or switch to the &lt;code&gt;next_global_id&lt;/code&gt; it mentions.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every alias (&lt;code&gt;m0&lt;/code&gt;, &lt;code&gt;m1&lt;/code&gt;, …) maps to the user at the same position in the batch.&lt;/li&gt;
&lt;li&gt;An alias fails when &lt;code&gt;errors&lt;/code&gt; contains an entry whose &lt;code&gt;path[0]&lt;/code&gt; is that alias. Every other alias was removed.&lt;/li&gt;
&lt;li&gt;If the response has &lt;code&gt;errors&lt;/code&gt; but no &lt;code&gt;path&lt;/code&gt; (for example a rate limit or authentication error), the whole request failed and nobody was removed. Retry the entire batch.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Which users to retry
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;NOT_FOUND&lt;/code&gt; ("Could not resolve to a node"): the user was already removed, deleted their account, or you passed the wrong ID type. Don't retry; re-run the step 1 query to see who is still unaffiliated.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;FORBIDDEN&lt;/code&gt; with "unavailable for Enterprise Managed User (EMU) enterprises": the mutation isn't supported on EMU and enterprises, so retrying never helps. Manage those users through your identity provider instead.&lt;/li&gt;
&lt;li&gt;Rate limit or timeout (&lt;code&gt;RATE_LIMITED&lt;/code&gt;, &lt;code&gt;502&lt;/code&gt;, &lt;code&gt;abuse&lt;/code&gt;/&lt;code&gt;secondary rate limit&lt;/code&gt; messages): wait a minute and retry those users, ideally in smaller batches.&lt;/li&gt;
&lt;li&gt;Permission errors (&lt;code&gt;FORBIDDEN&lt;/code&gt;, &lt;code&gt;INSUFFICIENT_SCOPES&lt;/code&gt;): retrying won't help. Fix the token scopes first.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Simplest and safest approach: after the loop, don't bother tracking &lt;code&gt;$retry&lt;/code&gt;; just run the script again. It queries the current unaffiliated list, so it only picks up whoever is still there, and &lt;code&gt;-DryRun&lt;/code&gt; shows exactly which users remain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Learn more
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.blog/changelog/2025-10-28-unaffiliated-users-for-ghec-accounts-now-generally-available/?ref=jessehouwing.net" rel="noopener noreferrer"&gt;Changelog: Unaffiliated users for GHEC accounts now generally available&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/graphql/reference/mutations?ref=jessehouwing.net#removeenterprisemember" rel="noopener noreferrer"&gt;GraphQL &lt;code&gt;removeEnterpriseMember&lt;/code&gt; mutation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>github</category>
    </item>
    <item>
      <title>How to enable GitHub Actions' immutable subject claims for OIDC and Azure</title>
      <dc:creator>Jesse Houwing</dc:creator>
      <pubDate>Mon, 19 Oct 2026 13:30:42 +0000</pubDate>
      <link>https://dev.to/jessehouwing/how-to-enable-github-actions-immutable-subject-claims-for-oidc-and-azure-453n</link>
      <guid>https://dev.to/jessehouwing/how-to-enable-github-actions-immutable-subject-claims-for-oidc-and-azure-453n</guid>
      <description>&lt;p&gt;You may have read previous posts where I documented my attempts to get rid of Personal Access Tokens, Client Certificates and other permanent secrets. And if so, you're likely at least somewhat familiar with OIDC.&lt;/p&gt;

&lt;p&gt;In the past you'd create a new App Registration in Azure, then set a Federated Credential on it and would copy the &lt;strong&gt;owner&lt;/strong&gt; and &lt;strong&gt;repository name&lt;/strong&gt;. Then Azure will let GitHub authenticate on your behalf using those fields in the claim.&lt;/p&gt;

&lt;p&gt;There is one drawback to this, however. When you organization or repository is ever deleted, renamed or transferred, the App Registration will have a &lt;em&gt;dangling credential&lt;/em&gt;. Anyone with the ability to create a new repo under the same name can regain access to that App Registration if they know the Client ID, Tennant ID and Subscription ID.&lt;/p&gt;

&lt;p&gt;To prevent this from happening GitHub added support for adding the Owner ID and Repository ID into the subject claim. These values uniquely identify the repository and will prevent a takeover.&lt;/p&gt;

&lt;h2&gt;
  
  
  Before
&lt;/h2&gt;

&lt;p&gt;If your repository is currently using OIDC, you may first need to enable "Use Immutable Subject Claim", or your claim prefix will only contain the names of the repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;repo:jessehouwing/azdo-marketplace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj2lfcolvpx6tv8jypjjs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj2lfcolvpx6tv8jypjjs.png" alt="How to enable GitHub Actions' immutable subject claims for OIDC and Azure" width="799" height="394"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  After
&lt;/h2&gt;

&lt;p&gt;After enabling the "Use Immutable Subject Claim", you will see that the &lt;strong&gt;owner id&lt;/strong&gt; and &lt;strong&gt;repository id&lt;/strong&gt; have been added to the claim prefix:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;repo:jessehouwing@4173387/azdo-marketplace@1158033287
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1mf4jljyiza2pwqss8m8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1mf4jljyiza2pwqss8m8.png" alt="How to enable GitHub Actions' immutable subject claims for OIDC and Azure" width="800" height="397"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Retrieving the identifiers
&lt;/h2&gt;

&lt;p&gt;If you need these values to use in automation, you can easily query them using the API:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; gh api repos/jessehouwing/azdo-marketplace --jq '{repo_name: .name, repo_id: .id, owner_name: .owner.login, owner_id: .owner.id}'

{
  "owner_id": 4173387,
  "owner_name": "jessehouwing",
  "repo_id": 1158033287,
  "repo_name": "azdo-marketplace"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  GitHub Enterprise
&lt;/h2&gt;

&lt;p&gt;If your repository is part of a GitHub Enterprise, you can set additional policies to include the Enterprise in your subject claim as well:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc39q6gp9gnv3wmmen9y5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc39q6gp9gnv3wmmen9y5.png" alt="How to enable GitHub Actions' immutable subject claims for OIDC and Azure" width="800" height="372"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And include custom repository properties. This is a very useful feature to enable specific claims for multiple repositories at once. For example, you could set a &lt;strong&gt;environment: dev&lt;/strong&gt; custom property on all repositories, which could grant all of these repos access to a Service Principal in Azure through a single federated credential.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F576k0of6ceiw0nt9wrer.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F576k0of6ceiw0nt9wrer.png" alt="How to enable GitHub Actions' immutable subject claims for OIDC and Azure" width="800" height="190"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Azure Side
&lt;/h2&gt;

&lt;p&gt;On the Azure side 2 new inputs have appeared, one for &lt;strong&gt;owner id&lt;/strong&gt; and one for &lt;strong&gt;repository id&lt;/strong&gt; :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdg64kf7km9pyrfqv1okx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdg64kf7km9pyrfqv1okx.png" alt="How to enable GitHub Actions' immutable subject claims for OIDC and Azure" width="800" height="530"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should set these values before enabling Immutable Subject Claims.&lt;/p&gt;

&lt;p&gt;If you want to use the enterprise claim or custom repository properties, you need to edit the Subject Identifier manually and supply your own format and adding the custom property by prefixing it with &lt;code&gt;repo_property_name:value&lt;/code&gt;.&lt;/p&gt;

</description>
      <category>github</category>
      <category>githubactions</category>
      <category>security</category>
    </item>
    <item>
      <title>Keep the creepy crawlies out of you workflows: securing GitHub Actions in 2026</title>
      <dc:creator>Jesse Houwing</dc:creator>
      <pubDate>Fri, 16 Oct 2026 13:57:52 +0000</pubDate>
      <link>https://dev.to/jessehouwing/keep-the-creepy-crawlies-out-of-you-workflows-securing-github-actions-in-2026-2np0</link>
      <guid>https://dev.to/jessehouwing/keep-the-creepy-crawlies-out-of-you-workflows-securing-github-actions-in-2026-2np0</guid>
      <description>&lt;p&gt;&lt;strong&gt;GitHub Actions is now one of the most used CI/CD platforms in the world, which also makes it an attractive target for attackers. After several large supply chain attacks, GitHub made many changes and added improvements to how Actions works over the past year. Many of the new protections are opt-in for existing organisations, and some of them are breaking changes. This article covers the attacks and the new protections, and ends with five things you should do now.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Fast growth and weak defaults
&lt;/h2&gt;

&lt;p&gt;GitHub introduced Actions in 2018 as a way to automate anything that happens in a repository: any event can start a workflow. In August 2019 Actions added CI/CD and became free for public repositories, which at that time meant around 40 million developers. It became generally available in November of that year.&lt;/p&gt;

&lt;p&gt;The Marketplace now lists more than 30,000 actions. According to GitHub, Actions ran about 23 million jobs a day in early 2024, and 71 million a day after GitHub rebuilt its backend. Public and open source projects alone used 11.5 billion Actions minutes in 2025, 35% more than the year before.&lt;/p&gt;

&lt;p&gt;Many of the early defaults favoured ease of use over security. Every workflow received a &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; that could read and write almost everything in the repository. Workflows could approve pull requests, which was enough to satisfy a "required approvals" rule. In 2020 GitHub added &lt;code&gt;pull_request_target&lt;/code&gt;, a trigger that runs the workflow of the base repository with a write-capable token and access to secrets. A normal &lt;code&gt;pull_request&lt;/code&gt; workflow from a fork only gets a read-only token and no secrets, which made it impossible for maintainers to label or comment on those pull requests automatically. The new trigger was meant to solve that.&lt;/p&gt;

&lt;p&gt;GitHub tightened the defaults step by step. In 2021 it stopped supporting abbreviated commit SHAs in &lt;code&gt;uses:&lt;/code&gt;. That left the full-length SHA as the only way to pin an action to code that cannot change. In the same year GitHub added the &lt;code&gt;permissions:&lt;/code&gt; key, required approval for workflow runs from first-time contributors, and introduced OpenID Connect for cloud deployments. In 2022 it added a setting to stop Actions from approving pull requests, but to avoid breaking existing workflows, GitHub left the permissive option enabled by default. In February 2023 the default token finally became read-only, but for new organisations and repositories only. Existing repositories had to opt in to the new default.&lt;/p&gt;

&lt;p&gt;Several of these decisions later led to serious security incidents.&lt;/p&gt;

&lt;h2&gt;
  
  
  The industrialisation of CI/CD attacks
&lt;/h2&gt;

&lt;p&gt;In 2021 the GitHub Security Lab described the "pwn request"&lt;sup&gt;[1]&lt;/sup&gt;: a &lt;code&gt;pull_request_target&lt;/code&gt; workflow that checks out and runs code from a fork. It also showed how pull request titles and branch names that are inserted into a &lt;code&gt;run:&lt;/code&gt; script with &lt;code&gt;${{ }}&lt;/code&gt; become shell injections, and it warned that masking secrets in logs does not really protect them, because code in the workflow can still read them and print them in another form. In 2023 Chainguard showed that a commit pushed to a fork can be referenced as if it belongs to the original action, a so-called "impostor commit". In the same year, researchers from Purdue University and North Carolina State University found injection vulnerabilities in a large number of open source workflows. In 2024 Adnan Khan showed that a workflow with a read-only token and no secrets could still poison the Actions cache and use it to attack release workflows. Palo Alto Networks' Unit 42 found tokens in the build artifacts of projects owned by Google, Microsoft and AWS.&lt;/p&gt;

&lt;p&gt;By the end of 2024, these techniques started to appear in real attacks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ultralytics, December 2024.&lt;/strong&gt; Attackers opened a pull request with a malicious branch name. A workflow inserted that name into a shell command, which gave the attackers code execution in the build of a very popular computer vision library. They used that access to poison the GitHub Actions cache. Four releases with a cryptominer were published to PyPI. The project's own release workflow restored the poisoned cache and built the first two. The attackers uploaded the other two with a PyPI token that had not been revoked.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;tj-actions/changed-files, March 2025.&lt;/strong&gt; This attack started one step earlier, at &lt;code&gt;reviewdog/action-setup&lt;/code&gt;. That compromise most likely exposed the personal access token of the tj-actions bot. The attackers used the token to move every version tag of &lt;code&gt;tj-actions/changed-files&lt;/code&gt;, an action used in more than 23,000 repositories, to a malicious commit. That commit dumped the memory of the runner and wrote the secrets it found into the workflow log, encoded twice with base64. In public repositories, anyone could read those logs. The real target turned out to be Coinbase. Only users who had pinned the action to a full commit SHA were not affected.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nx, August 2025.&lt;/strong&gt; On 21 August a pull request, generated with an AI coding assistant, added a &lt;code&gt;pull_request_target&lt;/code&gt; workflow that inserted the pull request title directly into a bash command. The workflow was removed the next day, but it still existed on older branches. On 24 August an attacker used it. The repository still used the read/write default from before 2023, so the stolen token could start the release workflow and steal the npm publishing token. Malicious versions of Nx, a package with around six million weekly downloads, were available for about four hours. The malware used the victims' own AI command-line tools to search for credentials, and a second wave made more than 5,500 private repositories public. The Nx postmortem points to the same root cause: GitHub changed the default in February 2023, but it never updated existing repositories.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Shai-Hulud and Shai-Hulud 2.0, September and November 2025.&lt;/strong&gt; Shai-Hulud built on the Nx incident and was the first npm worm that spread by itself. It started in an infected npm package, but it used GitHub Actions to spread. On every machine where the package was installed, it collected GitHub and npm tokens. With the GitHub tokens, it pushed a new workflow to every repository it could reach. GitHub then ran that workflow like any other, with access to the secrets of the repository, and the workflow sent those secrets to the attackers. With the stolen npm tokens, the worm published infected versions of more packages, and the cycle started again. GitHub removed more than 500 infected packages. The second wave, Shai-Hulud 2.0, hit more than 25,000 repositories and ran during &lt;code&gt;preinstall&lt;/code&gt;. It also registered infected machines as self-hosted runners, so the attackers could control them remotely through Actions workflows, as GitHub later explained in its own analysis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TeamPCP, March 2026.&lt;/strong&gt; A workflow in the Trivy repository, which its authors believed was secure, was vulnerable to a pwn request. It had been attacked earlier, and that incident had not been fully contained. This allowed the attackers to force-push 75 of the 76 &lt;code&gt;trivy-action&lt;/code&gt; version tags and to push impostor commits to &lt;code&gt;actions/checkout&lt;/code&gt;. Every pipeline that ran a Trivy scan leaked its secrets. Within days, the stolen credentials were used to compromise the KICS action and the LiteLLM package on PyPI.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mini Shai-Hulud, May 2026.&lt;/strong&gt; TeamPCP returned with a new variant that poisoned the Actions cache in a TanStack pull request workflow. When a maintainer later merged code, the legitimate release workflow restored the poisoned cache and ran the attacker's code. The worm used the runner's credentials through npm's OIDC publishing endpoint, rather than stealing an npm token directly. The following day, the fully weaponised worm was released in public repositories, making the toolchain available to other operators&lt;sup&gt;[2]&lt;/sup&gt;.&lt;/p&gt;

&lt;p&gt;These incidents follow the same pattern. A vulnerable workflow leaks a token, and the token is used to publish a malicious package or action. That package runs on developer machines and CI runners, where it steals more tokens. A worm repeats this without human involvement, and it spreads quickly. In its analysis of these attacks, Wiz notes that the time between a compromise and its detection is now measured in hours. GitHub came to the same conclusion in its 2026 roadmap&lt;sup&gt;[3]&lt;/sup&gt;: attackers now target the CI/CD automation itself, as well as the software it builds. Log masking does not stop this. A memory dump gives attackers the secrets, and simple encoding lets them exfiltrate those secrets, often through the logs. For a public repository, those logs are public.&lt;/p&gt;

&lt;h2&gt;
  
  
  GitHub asks the community
&lt;/h2&gt;

&lt;p&gt;On 7 November 2025 GitHub announced the first breaking change to &lt;code&gt;pull_request_target&lt;/code&gt;. On the same day it opened a public discussion called "Towards a secure by default GitHub Actions"&lt;sup&gt;[4]&lt;/sup&gt;. They asked the community which changes would have the most immediate effect on the security of workflows, and of the supply chains that depend on them.&lt;/p&gt;

&lt;p&gt;Many practitioners and security researchers, including me, joined the discussion. They described the problems they saw in their own organisations and proposed possible solutions, and GitHub's engineers responded in the thread. The discussion once again showed the tension between adding security and not breaking critical workflows across the whole ecosystem. In an organisation with 8,000 repositories, you cannot fix every workflow by hand before a setting changes.&lt;/p&gt;

&lt;p&gt;When the first change was enforced, many users only learned about it because their workflows had broken. The change to environment branch rules, which was part of the same update, had broken deployments that matched on branch names. Other users asked why GitHub had not added warning annotations to workflow runs in advance, and one even threatened to move to GitLab. GitHub replied that it had not made the decision lightly, and that these breaking changes were necessary to make Actions more secure.&lt;/p&gt;

&lt;p&gt;Most of the larger changes in 2026 came with an evaluate or log mode, or with an enforcement date that was announced in advance.&lt;/p&gt;

&lt;h2&gt;
  
  
  What GitHub changed
&lt;/h2&gt;

&lt;p&gt;Most of the changes GitHub made in the past twelve months address some specific part that enabled the attack patterns described above.&lt;/p&gt;

&lt;h3&gt;
  
  
  Changes to &lt;code&gt;pull_request_target&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Since 8 December 2025, &lt;code&gt;pull_request_target&lt;/code&gt; always runs the workflow definition from the default branch. An attacker can no longer target a vulnerable workflow that still exists on an old branch, which is what happened at Nx. Fixing the workflow on the default branch is now enough.&lt;/p&gt;

&lt;p&gt;In June 2026 GitHub addressed the pwn request itself. &lt;code&gt;actions/checkout&lt;/code&gt; v7 refuses to check out the code of a pull request from a fork in &lt;code&gt;pull_request_target&lt;/code&gt; workflows, and in &lt;code&gt;workflow_run&lt;/code&gt; workflows that were triggered by a pull request. To override this, you have to add the input &lt;code&gt;allow-unsafe-pr-checkout&lt;/code&gt;. GitHub chose that name so it stands out in code review:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt; &lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pull_request_target&lt;/span&gt;
 &lt;span class="s"&gt;...&lt;/span&gt;
       &lt;span class="s"&gt;- uses&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v7&lt;/span&gt;
         &lt;span class="s"&gt;with&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
           &lt;span class="na"&gt;ref&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ github.event.pull_request.head.sha }}&lt;/span&gt;
&lt;span class="na"&gt;+          allow-unsafe-pr-checkout&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On 20 July GitHub backported this protection to all supported major versions except v1. Workflows that use a floating tag such as &lt;code&gt;actions/checkout@v4&lt;/code&gt; received it automatically. Workflows pinned to a full SHA, as security guidance has recommended for years, by design do not receive it and need to be updated. The protection blocks the most common pattern by default, and though it does not solve every possible variant, it is a big step forward. A &lt;code&gt;run:&lt;/code&gt; step that fetches the pull request with &lt;code&gt;git&lt;/code&gt; or the &lt;code&gt;gh&lt;/code&gt; CLI can still bring in untrusted code, and so can pwn requests through other triggers such as &lt;code&gt;issue_comment&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;actions/checkout&lt;/code&gt; no longer leaks the token
&lt;/h3&gt;

&lt;p&gt;Since v2, &lt;code&gt;actions/checkout&lt;/code&gt; has stored the job's token in &lt;code&gt;.git/config&lt;/code&gt;, so that later git commands can use it. If you uploaded your workspace as an artifact, or copied it into a container image, the token was included. The ArtiPACKED research found tokens that had leaked this way.&lt;/p&gt;

&lt;p&gt;In September 2024 GitHub changed &lt;code&gt;upload-artifact&lt;/code&gt; to skip hidden files by default. And in November 2025 checkout v6 moved the credential out of the repository to a file under &lt;code&gt;$RUNNER_TEMP&lt;/code&gt;. If your job does not need to push, &lt;code&gt;persist-credentials: false&lt;/code&gt; is still the safer choice.&lt;/p&gt;

&lt;h3&gt;
  
  
  Workflow execution protections
&lt;/h3&gt;

&lt;p&gt;By default, every user with write access to a repository can trigger its workflows. Workflow execution protections, generally available since 17 September 2026, let you change that. They are built on rulesets and repository custom properties, and you can configure them at enterprise, organisation and repository level. Actor rules define which users, roles, GitHub Apps, Copilot or Dependabot may trigger a workflow. Event rules define which events may start one. A third rule, "Require lockfile", only lets a workflow run when it has a lock file for its actions. It is described further in the section on pinning. You can apply these rules to specific workflow files. For example, you can allow only maintainers to run &lt;code&gt;workflow_dispatch&lt;/code&gt; on &lt;code&gt;deploy.yml&lt;/code&gt;, or block &lt;code&gt;pull_request_target&lt;/code&gt; across the organisation. You can run the rules in evaluate mode first, and the insights show which runs would have been blocked.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkyb5zakzyazn90fmgv0x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkyb5zakzyazn90fmgv0x.png" alt="Keep the creepy crawlies out of you workflows: securing GitHub Actions in 2026" width="799" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;An actor rule that only lets maintainers and repository administrators trigger the deployment workflow.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5oblazub7cyle1ylsdvq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F5oblazub7cyle1ylsdvq.png" alt="Keep the creepy crawlies out of you workflows: securing GitHub Actions in 2026" width="800" height="244"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The protections a ruleset can apply.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4x6y6yqzktmurgu1fr00.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4x6y6yqzktmurgu1fr00.png" alt="Keep the creepy crawlies out of you workflows: securing GitHub Actions in 2026" width="800" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;In evaluate mode, the policy insights show which runs a rule would have blocked.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;GitHub also added a default rule. Public repositories that do not have their own event policy now automatically disable &lt;code&gt;pull_request_target&lt;/code&gt;. The rule runs in evaluate mode now and will be enforced from Monday 2 November 2026. Private and internal repositories are not affected. If a workflow really needs the trigger, you can allow it explicitly for that single workflow file.&lt;/p&gt;

&lt;p&gt;Rules like these only help when the attacker does not already have write access. Shai-Hulud used stolen credentials to push new workflows, and GitHub started those runs just like any other, because they came from an account that was allowed to push. To stop this, GitHub now holds workflow runs in public repositories that it considers potentially malicious. A held run only starts after a collaborator with write access approves it in an authenticated web session.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcivoknxs4tqxbpla7z7i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fcivoknxs4tqxbpla7z7i.png" alt="Keep the creepy crawlies out of you workflows: securing GitHub Actions in 2026" width="800" height="388"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;GitHub holds a potentially malicious workflow run until someone with write access approves it.&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Read-only caches and &lt;code&gt;cache-mode&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Since 26 June 2026 the cache token is read-only for events that someone without write access can trigger, when they run in the cache scope of the default branch. This covers &lt;code&gt;pull_request_target&lt;/code&gt;, &lt;code&gt;issue_comment&lt;/code&gt; and &lt;code&gt;workflow_run&lt;/code&gt; chains that start from a fork. It blocks the attack Adnan Khan demonstrated, in which a low-trust workflow poisons a cache entry that a trusted &lt;code&gt;push&lt;/code&gt; or &lt;code&gt;schedule&lt;/code&gt; workflow restores later.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;cache-mode&lt;/code&gt; setting, generally available since 10 September, gives you more control. You can set it to &lt;code&gt;read&lt;/code&gt;, &lt;code&gt;write&lt;/code&gt;, &lt;code&gt;write-only&lt;/code&gt; or &lt;code&gt;none&lt;/code&gt; for a workflow or for a single job. The cache service enforces the setting, and a reusable workflow cannot get more cache access than the workflow that calls it. In 2024 Khan already advised against caching in release workflows. With &lt;code&gt;cache-mode: none&lt;/code&gt; you can now enforce that:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;+cache-mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
&lt;span class="s"&gt;+&lt;/span&gt;
 &lt;span class="s"&gt;jobs&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
   &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
     &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
&lt;span class="na"&gt;+    cache-mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
   &lt;span class="s"&gt;release&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
     &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;
&lt;span class="na"&gt;+    cache-mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;none&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The workflow-level setting applies to every job, and a job-level setting overrides it. A job that tries to save or restore outside its mode does not fail. The cache step logs a message and continues.&lt;/p&gt;

&lt;h3&gt;
  
  
  Pinning, lock files and immutable releases
&lt;/h3&gt;

&lt;p&gt;Since August 2025 an organisation can require that every action is pinned to a full-length commit SHA&lt;sup&gt;[5]&lt;/sup&gt;. Workflows with unpinned actions then fail instead of only showing a warning. The same policy can block a specific action with a &lt;code&gt;!&lt;/code&gt; prefix, which is useful during an incident.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvan2f7vnc0xvs1f2rm3q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvan2f7vnc0xvs1f2rm3q.png" alt="Keep the creepy crawlies out of you workflows: securing GitHub Actions in 2026" width="800" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Blocking every version of a compromised action in the organisation's Actions policy. The SHA pinning option on the same page still works, but the lock files described below pin actions more completely.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;$/&lt;/code&gt; syntax, added in July 2026, fixes a related problem with actions that live in the same repository as the workflow. Before this, there were two ways to reference them. With a &lt;code&gt;./&lt;/code&gt; path, the runner executes whatever files are at that path on its disk when the step starts. Usually a checkout put them there, but an extracted zip file, a downloaded artifact or any earlier step that writes to the workspace can put them there too. In the Trivy attack, the workflow checked out the pull request and then ran an internal action from that checkout, which the attacker had replaced.&lt;/p&gt;

&lt;p&gt;The other way was a reference such as &lt;code&gt;my-org/my-repo/.github/actions/setup@v1&lt;/code&gt;. That reference does not follow the commit that is running, so a caller who pins your reusable workflow to a SHA still gets whatever &lt;code&gt;v1&lt;/code&gt; points to. A hard-coded SHA avoids that, but then you have to update the reference after every change. In both cases your SHA pins protect less than you think, which GitHub also acknowledges in its announcement. A &lt;code&gt;$/&lt;/code&gt; reference resolves to the workflow's own repository at the exact commit that is running, so it does not depend on what is on the disk of the runner. You do not even need a checkout for it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;     &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt;    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v6&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt;    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;./.github/actions/setup&lt;/span&gt;
&lt;span class="na"&gt;+    - uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$/.github/actions/setup&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The same works for reusable workflows in the same repository:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt; &lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt;    &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-org/my-repo/.github/workflows/build.yml@v1&lt;/span&gt;
&lt;span class="na"&gt;+    uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;$/.github/workflows/build.yml&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A &lt;code&gt;$/&lt;/code&gt; reference in a reusable workflow always resolves against the repository of that reusable workflow, not the repository that calls it. The syntax is not available on GitHub Enterprise Server.&lt;/p&gt;

&lt;p&gt;Pinning to a SHA also has drawbacks. A SHA is hard to read, you have to maintain it in every workflow file, and, as I explained in my trust checklist&lt;sup&gt;[6]&lt;/sup&gt;, a SHA on its own does not protect you against an impostor commit. Two newer features address this.&lt;/p&gt;

&lt;p&gt;Immutable releases, generally available since October 2025, are a feature for publishers of actions. Once enabled, newly published releases cannot be changed and GitHub generates a signed attestation. Existing releases remain mutable until they are published again. My &lt;code&gt;jessehouwing/actions-semver-checker&lt;/code&gt; action&lt;sup&gt;[7]&lt;/sup&gt; republishes existing releases and checks that floating tags point to the latest patch release.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fer4cfxhafzdjdq95s7j5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fer4cfxhafzdjdq95s7j5.png" alt="Keep the creepy crawlies out of you workflows: securing GitHub Actions in 2026" width="800" height="103"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Publishers enable immutable releases in the repository settings. Existing releases stay mutable until they are published again.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;github/gh-actions-lock&lt;/code&gt;&lt;sup&gt;[8]&lt;/sup&gt; is a tool for consumers of actions, and a new way to pin them. When you generate &lt;code&gt;.github/workflows/actions.lock&lt;/code&gt;, it records the commit SHA behind every action reference automatically, including the actions that composite actions use, so your workflow files can keep readable version references. The "Require lockfile" workflow execution protection lets you require a lock file for every workflow. If you currently require SHA pins, you'll also want to add this rule: generate lock files, run the rule in evaluate mode and then enforce it.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Approach&lt;/th&gt;
&lt;th&gt;Advantages&lt;/th&gt;
&lt;th&gt;Limitations&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SHA pinning&lt;/td&gt;
&lt;td&gt;Locks an action to one exact commit and works with every action today. It does not depend on the publisher enabling a setting. GitHub can enforce full-length SHA pins in Actions policy, and Advanced Security for Actions understands them.&lt;/td&gt;
&lt;td&gt;Commit SHAs are difficult to read and maintain. You must update every reference yourself, and a SHA alone does not prove that the commit belongs to the release you intended. It also does not lock dependencies used inside a composite action.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Immutable releases&lt;/td&gt;
&lt;td&gt;Keeps a readable version such as &lt;code&gt;v1.2.3&lt;/code&gt;, prevents the tag and release assets from being changed, and provides a signed attestation.&lt;/td&gt;
&lt;td&gt;The action publisher must enable it. No Actions policy currently recognises an immutable release as immutable, so you cannot trust these references through policy. Floating tags such as &lt;code&gt;v1&lt;/code&gt; are not protected, and an immutable release does not lock transitive dependencies by itself.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Lock files&lt;/td&gt;
&lt;td&gt;Records the exact commits behind the action references and checks that they still belong to the expected refs. Its distinct advantage is that it also locks transitive dependencies used by composite actions. GitHub can enforce lock file use with the "Require lockfile" workflow execution protection, and Advanced Security for Actions understands lock files.&lt;/td&gt;
&lt;td&gt;The lock file has to be generated, reviewed and updated. In a large monorepo, all workflows share the same lock file. Dependency update tools such as Dependabot and Renovate are still rolling out support.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These approaches can be combined. Lock files provide the strongest protection for consumers, because they fix the complete set of action commits, including the dependencies of composite actions. Immutable releases provide the strongest protection for authors, because published tags and release assets cannot be replaced. No policy recognises immutable releases yet, and they do not lock transitive dependencies, so combine them with lock files. Authors then publish a verifiable release, and consumers independently lock the exact dependency graph they run. Traditional SHA pins still work, but lock files do the same job more completely.&lt;/p&gt;

&lt;p&gt;All three approaches freeze the reference until you update it. That prevents a compromised release from entering automatically, but it also means you do not receive security fixes automatically.&lt;/p&gt;

&lt;p&gt;To deal with that, enable Dependabot to propose updates for you, and configure a cooldown period so you are not among the first to install a new release. The delay gives GitHub, StepSecurity and other security vendors time to detect a compromised release before it reaches your repository. Dependabot now waits three days by default before it proposes a new version, while security updates are still proposed immediately. Wiz cites research showing that a delay of 7 to 14 days would catch 80 to 90% of supply chain attacks.&lt;/p&gt;

&lt;p&gt;A minimal &lt;code&gt;.github/dependabot.yml&lt;/code&gt; that keeps your actions up to date with a seven-day cooldown looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
&lt;span class="na"&gt;updates&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;package-ecosystem&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;github-actions"&lt;/span&gt;
    &lt;span class="na"&gt;directory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/"&lt;/span&gt; &lt;span class="c1"&gt;# also covers .github/workflows&lt;/span&gt;
    &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;interval&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;weekly"&lt;/span&gt;
    &lt;span class="na"&gt;cooldown&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;default-days&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;7&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pinning to an immutable release or using a lock file has another benefit. Few people know that Dependabot does not create security alerts for actions that are pinned to a SHA. It needs a version number to compare with the security advisory. There are temporary workarounds, such as my own &lt;code&gt;jessehouwing/actions-dependency-submission&lt;/code&gt; action&lt;sup&gt;[9]&lt;/sup&gt;, which maps those SHAs back to version numbers. When you pin to an immutable release version, or use a lock file so your workflow files keep their version references, you get these security alerts and updates without extra work. Make sure the release is actually immutable. A version tag on a mutable release also gives you security alerts, but the publisher, or an attacker with their credentials, can move it to other code at any time, as happened with tj-actions and Trivy.&lt;/p&gt;

&lt;h3&gt;
  
  
  The egress firewall
&lt;/h3&gt;

&lt;p&gt;GitHub-hosted runners can connect to any host on the internet. It does not matter how you limited the &lt;code&gt;GITHUB_TOKEN&lt;/code&gt;, how you scoped your secrets, or whether you use OIDC and pinned every action. Those controls decide what a workflow can do inside GitHub, but nothing controls where it can send data. Several of the attacks above relied on this, to download their payload or to send stolen secrets to the attackers.&lt;/p&gt;

&lt;p&gt;The native egress firewall&lt;sup&gt;[10]&lt;/sup&gt; is a technical preview for Linux runners, which you enable with &lt;code&gt;runs-on: ubuntu-24.04-firewall&lt;/code&gt;. It runs outside the runner VM, so it keeps working even if a workflow gains root access. It enforces an allow list from &lt;code&gt;.github/egress-firewall.yaml&lt;/code&gt;, and it inspects HTTPS traffic with a unique certificate for every run. Start in &lt;code&gt;log&lt;/code&gt; mode, build the allow list from the connections your workflows actually make, and then switch to &lt;code&gt;enforce&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt; &lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
   &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt;    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-24.04&lt;/span&gt;
&lt;span class="na"&gt;+    runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-24.04-firewall&lt;/span&gt;


&lt;span class="c1"&gt;# .github/egress-firewall.yaml&lt;/span&gt;
&lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;log&lt;/span&gt; &lt;span class="c1"&gt;# switch to enforce once the allow list is complete&lt;/span&gt;
&lt;span class="na"&gt;allow&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;api.github.com&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;registry.npmjs.org&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The firewall always allows a small set of GitHub endpoints, such as &lt;code&gt;github.com&lt;/code&gt; and &lt;code&gt;codeload.github.com&lt;/code&gt;, unless you set &lt;code&gt;no-default-urls: true&lt;/code&gt;. The policy file is read from the same ref as the workflow, so a change on &lt;code&gt;main&lt;/code&gt; does not affect runs from other branches. In log mode, the connections are listed in the workflow run summary and in an artifact of the run. In the preview, log mode can still break some requests, and runs take roughly 15 to 20% longer. StepSecurity's &lt;code&gt;step-security/harden-runner&lt;/code&gt;, which detected the tj-actions compromise, offers similar controls today.&lt;/p&gt;

&lt;h3&gt;
  
  
  OIDC and trusted publishing
&lt;/h3&gt;

&lt;p&gt;GitHub Actions has supported OpenID Connect since 2021. A workflow exchanges a short-lived, signed token for cloud credentials, so you do not need to store long-lived cloud secrets in GitHub. Two changes in 2026 make this more secure.&lt;/p&gt;

&lt;p&gt;Immutable subject claims add the owner and repository IDs to the subject of the token, for example &lt;code&gt;repo:octocat@123456/my-repo@456789:ref:refs/heads/main&lt;/code&gt;. Before this change, the subject only contained names. If someone reused a repository or organisation name, they could request tokens with the same subject, and get access to cloud resources that still trusted the original repository. The new format is the default for repositories that are created, renamed or transferred after 15 July 2026. Older repositories have to be switched to the new format explicitly, and you have to update your cloud trust policies to match:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight diff"&gt;&lt;code&gt;&lt;span class="gd"&gt;-repo:octocat/my-repo:ref:refs/heads/main
&lt;/span&gt;&lt;span class="gi"&gt;+repo:octocat@123456/my-repo@456789:ref:refs/heads/main
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can now include repository custom properties in the token, as &lt;code&gt;repo_property_*&lt;/code&gt; claims. Give every repository that may deploy to production a property, and one cloud trust policy can check that claim, instead of listing each repository by name.&lt;/p&gt;

&lt;p&gt;Package registries made a similar change. Trusted publishing on npm, PyPI and NuGet replaces long-lived publishing tokens, like the ones stolen from Nx and LiteLLM, with a short-lived credential that is bound to a specific workflow.&lt;/p&gt;

&lt;p&gt;The same idea applies inside GitHub. When a workflow needs more than the &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; can do, for example to push to another repository or to start another workflow, many teams store a personal access token as a secret. That token is long-lived, often has broad access, and acts as the person who created it. The tj-actions attack started with exactly such a token. A custom GitHub App can now replace personal access tokens in most of these cases. The workflow stores the private key of the app and uses the &lt;code&gt;actions/create-github-app-token&lt;/code&gt; action&lt;sup&gt;[11]&lt;/sup&gt; to exchange it for an installation token when the job starts. That token expires after one hour and only works on the repositories where the app is installed. If you use the same app for more than one purpose, you can limit each token further: the &lt;code&gt;repositories&lt;/code&gt; input restricts it to specific repositories, and the &lt;code&gt;permission-*&lt;/code&gt; inputs, such as &lt;code&gt;permission-contents: write&lt;/code&gt;, request only those specific permissions the job needs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;       &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/create-github-app-token@v2&lt;/span&gt;
         &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app-token&lt;/span&gt;
         &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
           &lt;span class="na"&gt;app-id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ vars.APP_ID }}&lt;/span&gt;
           &lt;span class="na"&gt;private-key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.APP_PRIVATE_KEY }}&lt;/span&gt;
&lt;span class="na"&gt;+          repositories&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;docs&lt;/span&gt;
&lt;span class="na"&gt;+          permission-contents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
       &lt;span class="s"&gt;- uses&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@v7&lt;/span&gt;
         &lt;span class="s"&gt;with&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;
           &lt;span class="na"&gt;repository&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;my-org/docs&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt;          &lt;span class="na"&gt;token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.PERSONAL_ACCESS_TOKEN }}&lt;/span&gt;
&lt;span class="na"&gt;+          token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ steps.app-token.outputs.token }}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Before you add an app token or a personal access token at all, ask why the &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; cannot do the job. There is usually a good reason. For example, GitHub does not let the &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; start new workflow runs, so one workflow cannot trigger an endless chain of others, or give an attacker a way to reach a more privileged workflow. In the same way, the &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; can never receive the &lt;code&gt;workflows&lt;/code&gt; permission, so it cannot push changes to files in &lt;code&gt;.github/workflows&lt;/code&gt;. Without that limit, an attacker who controls one run could change a workflow to give itself more permissions, or add &lt;code&gt;toJSON(secrets)&lt;/code&gt; to dump every secret in a future run. Every extra permission you hand to a workflow bypasses one of these limits. Doing that safely requires a detailed understanding of GitHub's security model, so treat it as an exception that needs a careful review, not as a standard solution.&lt;/p&gt;

&lt;h3&gt;
  
  
  From research to detection
&lt;/h3&gt;

&lt;p&gt;GitHub now also detects many of the weaknesses described in this article automatically, and that detection grew out of security research. In late 2024 the GitHub Security Lab helped secure more than 75 workflows in open source projects and disclosed more than 90 vulnerabilities, in projects from Microsoft, AWS, Cloudflare and Apache, among others.&lt;/p&gt;

&lt;p&gt;That research became CodeQL for GitHub Actions. Its 18 queries track untrusted data through steps, jobs, composite actions and even Bash scripts. They find untrusted checkouts, injections, artifact and cache poisoning, unpinned tags and missing permissions. CodeQL for Actions became generally available in April 2025, after the preview had reported more than 800,000 findings in 158,000 repositories. It is part of the default setup of code scanning and is free for public repositories. CodeQL 2.26.4 (September 2026) added detection of mutable references to reusable workflows.&lt;/p&gt;

&lt;p&gt;Static analysis often cannot recognise the custom checks that make a risky-looking workflow safe, such as a condition that only lets maintainers trigger it. The Security Lab now runs its CodeQL alerts through an open source LLM framework, the Taskflow Agent. It collects the information a human reviewer would check, such as triggers, permissions, secrets and callers, and only writes a bug report for alerts that pass those checks. Since August 2025 it has found around 30 real vulnerabilities. A researcher reviews every report before it is sent. Detection now also happens before a workflow runs: as described earlier, GitHub holds workflow runs in public repositories that it identifies as potentially malicious, until a collaborator with write access approves them.&lt;/p&gt;

&lt;p&gt;Outside GitHub, the open source tool zizmor&lt;sup&gt;[12]&lt;/sup&gt; checks workflows for template injection, dangerous triggers, cache poisoning, impostor commits, excessive permissions and missing cooldowns, among other problems.&lt;/p&gt;

&lt;p&gt;The Security Lab's &lt;code&gt;GitHubSecurityLab/actions-permissions&lt;/code&gt; monitor&lt;sup&gt;[13]&lt;/sup&gt; helps you find the minimal permissions for a job. You add the monitor as the first step of the job and run the workflow as usual. While the job runs, the monitor records every call that is made to GitHub with the &lt;code&gt;GITHUB_TOKEN&lt;/code&gt;. At the end of the job, it proposes the minimal &lt;code&gt;permissions:&lt;/code&gt; block that those calls need, in the job summary. Because it only sees what actually happens, run it for every path through the workflow, such as a push, a pull request and a release, before you copy the result into your workflow.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is still coming
&lt;/h3&gt;

&lt;p&gt;The 2026 roadmap describes more changes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;secrets that can be limited to specific workflows, branches or environments, instead of being inherited automatically;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;a separate permission for managing secrets. Part of this is already available. The built-in Write role still includes secret management, but managing secrets is now a separate permission in custom roles. You can create a custom role based on Triage that adds all the other permissions of Write, except "Manage repository Actions secrets";&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;an Actions Data Stream that sends execution telemetry to your own storage and SIEM in near real time.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When GitHub published the roadmap in March, it expected these changes within three to nine months.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why you should not wait for the defaults
&lt;/h2&gt;

&lt;p&gt;Almost all of these protections are either opt-in for existing organisations, or they arrive as a breaking change once GitHub decides the risk is too high. The 2023 read-only default never reached older repositories. GitHub's Security Lab has found that many workflows still run with a token that can write everything, because older repositories kept their original default settings. The checkout fix reached workflows that use floating tags, but not the workflows that are pinned to a SHA, which is what security guidance used to recommend. Lock files now pin actions automatically, including their transitive dependencies, but it will take a long time before all existing workflows have moved to them. The &lt;code&gt;pull_request_target&lt;/code&gt; default will be enforced on 2 November, whether your workflows are ready or not. If you enable a protection yourself, you can evaluate it first and fix what breaks. If you wait, the change happens on GitHub's schedule, and you find out when a workflow fails.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five things to do now
&lt;/h2&gt;

&lt;p&gt;GitHub has started to make Actions secure by default, but many of the new defaults only apply to new repositories, and require explicit enablement for existing ones.&lt;/p&gt;

&lt;p&gt;For each area, the first list contains advice that security guidance has repeated for years&lt;sup&gt;[14]&lt;/sup&gt;, yet many organisations have still not followed. The second list contains the new features described earlier in this article.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Restrict token permissions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every workflow run receives a &lt;code&gt;GITHUB_TOKEN&lt;/code&gt;, and in older repositories that token can often still write almost everything. The less a token can do, the less an attacker can do with it after a leak.&lt;/p&gt;

&lt;p&gt;What you should already be doing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set the default workflow permissions to "Read repository contents and packages permissions" at enterprise and organisation level.&lt;/li&gt;
&lt;li&gt;Turn off "Allow GitHub Actions to create and approve pull requests".&lt;/li&gt;
&lt;li&gt;Require approval for workflow runs from all outside contributors, not only from first-time contributors.&lt;/li&gt;
&lt;li&gt;Start every workflow with &lt;code&gt;permissions: {}&lt;/code&gt; and grant permissions per job. Use &lt;code&gt;GitHubSecurityLab/actions-permissions&lt;/code&gt; to find the permissions each job needs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F95t8x8zgqyht39k8cn4w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F95t8x8zgqyht39k8cn4w.png" alt="Keep the creepy crawlies out of you workflows: securing GitHub Actions in 2026" width="800" height="332"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Read-only token permissions as the organisation default, and Actions not allowed to create or approve pull requests.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjdx280pcdq5gfcshn7tl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjdx280pcdq5gfcshn7tl.png" alt="Keep the creepy crawlies out of you workflows: securing GitHub Actions in 2026" width="799" height="318"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Require approval for all external contributors, not only for first-time contributors.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;What to add now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Before you change the organisation default, use the missing-permissions query in CodeQL to find the workflows that do not declare the permissions they need.&lt;/li&gt;
&lt;li&gt;Set &lt;code&gt;cache-mode: read&lt;/code&gt; for jobs that only restore a cache, and &lt;code&gt;cache-mode: none&lt;/code&gt; for release jobs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Limit who and what can trigger your workflows&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A workflow is only as safe as the people and events that can start it, especially when it has access to secrets or can deploy.&lt;/p&gt;

&lt;p&gt;What you should already be doing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replace &lt;code&gt;pull_request_target&lt;/code&gt; where you can. A normal &lt;code&gt;pull_request&lt;/code&gt; trigger works for most cases. For most of the remaining cases, split the work into a &lt;code&gt;pull_request&lt;/code&gt; workflow and a privileged &lt;code&gt;workflow_run&lt;/code&gt; workflow, and treat everything that passes between them, including artifacts, as untrusted.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What to add now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Update workflows that pin &lt;code&gt;actions/checkout&lt;/code&gt;, so they receive the new protection against pull request checkouts.&lt;/li&gt;
&lt;li&gt;Enable workflow execution protections in evaluate mode and review the insights. GitHub's default rule only covers public repositories, so add your own rules for private and especially internal repositories, where, depending on the default permissions of your enterprise, every member of the enterprise can trigger a workflow.&lt;/li&gt;
&lt;li&gt;Allow only maintainers to run &lt;code&gt;workflow_dispatch&lt;/code&gt; on deployment workflows.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Pin and lock your dependencies&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every action you use is code from someone else that runs with your token and secrets. Make sure that code cannot change without you noticing, and that you still receive updates in a controlled way.&lt;/p&gt;

&lt;p&gt;What you should already be doing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Let Dependabot update your actions, and inspect the changes in those actions before you merge the updates.&lt;/li&gt;
&lt;li&gt;Add &lt;code&gt;actions/dependency-review-action&lt;/code&gt;&lt;sup&gt;[15]&lt;/sup&gt; to your pull request checks and make it required, so a pull request that adds an action with a known vulnerability cannot be merged.&lt;/li&gt;
&lt;li&gt;Be selective about the actions you use. Use fewer actions, and prefer maintainers who use immutable releases, pin their own dependencies and scan their own workflows. My trust checklist describes which signals matter and which do not&lt;sup&gt;[6:1]&lt;/sup&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What to add now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Commit a lock file with &lt;code&gt;gh-actions-lock&lt;/code&gt;, and prefer immutable release versions over bare SHAs.&lt;/li&gt;
&lt;li&gt;Strengthen the "Require actions to be pinned to a full-length commit SHA" policy with the "Require lockfile" workflow execution protection.The new policy ensures that all workflows are covered by a lock file. Run the new rule in evaluate mode first, then enforce it.&lt;/li&gt;
&lt;li&gt;Configure a Dependabot cooldown of seven days instead of the default three.&lt;/li&gt;
&lt;li&gt;Reference actions in your own repository with &lt;code&gt;$/&lt;/code&gt; instead of &lt;code&gt;./&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Where you still pin to a SHA, use &lt;code&gt;jessehouwing/actions-dependency-submission&lt;/code&gt;&lt;sup&gt;[9:1]&lt;/sup&gt;, so Dependabot and dependency review still see the versions you use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Replace long-lived secrets&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A secret that is stored in GitHub stays valid until someone rotates it, so a single leak can be used for months. Short-lived credentials that are issued for one job limit the damage to minutes.&lt;/p&gt;

&lt;p&gt;What you should already be doing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use OIDC for Azure, AWS and GCP instead of client secrets, access keys or certificates.&lt;/li&gt;
&lt;li&gt;Switch to trusted publishing for your packages.&lt;/li&gt;
&lt;li&gt;Store the remaining secrets in environments with required reviewers and deployment branch rules, and only give them to the job that needs them.&lt;/li&gt;
&lt;li&gt;Replace personal access tokens with a custom GitHub App and &lt;code&gt;actions/create-github-app-token&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What to add now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Switch your existing repositories to immutable subject claims&lt;sup&gt;[16]&lt;/sup&gt;, and update the trust policies at the same time.&lt;/li&gt;
&lt;li&gt;Use custom property claims&lt;sup&gt;[17]&lt;/sup&gt; in your trust policies, instead of listing every repository by name.&lt;/li&gt;
&lt;li&gt;When you use &lt;code&gt;actions/create-github-app-token&lt;/code&gt;, limit every app token with the &lt;code&gt;repositories&lt;/code&gt; and &lt;code&gt;permission-*&lt;/code&gt; inputs.&lt;/li&gt;
&lt;li&gt;Use a custom role without "Manage repository Actions secrets" for people who do not need to manage secrets.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Scan your workflows and treat logs as public&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most of the attacks in this article started with a workflow problem that a scanner could have found. Assume that anything a workflow prints or uploads can be read by an attacker, and that you will need to respond quickly when something goes wrong.&lt;/p&gt;

&lt;p&gt;What you should already be doing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set &lt;code&gt;persist-credentials: false&lt;/code&gt; unless the job needs to push.&lt;/li&gt;
&lt;li&gt;Keep secrets out of command lines and URLs.&lt;/li&gt;
&lt;li&gt;Capture the output of tools that may print secrets, such as the Azure CLI.&lt;/li&gt;
&lt;li&gt;Scan logs and artifacts with tools such as TruffleHog or StepSecurity, and rotate every secret you find.&lt;/li&gt;
&lt;li&gt;Know how to revoke credentials in bulk when an incident happens.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What to add now:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Enable the default setup of CodeQL, which includes Actions. Then make the results blocking with a "Require code scanning results" rule in a ruleset. Don't have GitHub Advanced Security? Use an alternative, like zizmor, in your CI.&lt;/li&gt;
&lt;li&gt;Run the egress firewall or set up &lt;code&gt;step-security/harden-runner&lt;/code&gt; in log mode, and switch to enforce once your allow list is stable.&lt;/li&gt;
&lt;li&gt;Know how to block a compromised action with the &lt;code&gt;!&lt;/code&gt; policy prefix.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F14f3cykfq5d454kponm7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F14f3cykfq5d454kponm7.png" alt="Keep the creepy crawlies out of you workflows: securing GitHub Actions in 2026" width="800" height="233"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;A ruleset that blocks a merge when CodeQL reports a high or critical security alert, or an error.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;GitHub Actions has grown quickly since its original release, and for a long time its defaults favoured ease of use over security. Researchers warned about pwn requests, injections and cache poisoning for years, but it took a series of real attacks, from Ultralytics to tj-actions, Nx, Shai-Hulud, Trivy and Mini Shai-Hulud, before everyone started to take those warnings seriously.&lt;/p&gt;

&lt;p&gt;The past year has brought the largest push for Actions security since the platform launched. GitHub has also changed its approach. Where it used to leave existing repositories untouched, it now enforces important changes, and it accepts breaking changes when that is what it takes to protect the ecosystem. It announces those changes in advance and usually offers an evaluate mode first, but the direction is clear: secure defaults will reach your existing repositories too.&lt;/p&gt;

&lt;p&gt;That does not mean the work is done. Many of the new protections still have to be enabled, configured or adopted by the people who use Actions. Organisations have to review their settings, their workflows and their secrets. Authors of actions on the Marketplace have to protect their own repositories, publish immutable releases and pin their own dependencies, because everyone who uses their action depends on it.&lt;/p&gt;

&lt;p&gt;I do not expect these to be the last changes. Agentic workflows and the Copilot coding agent use GitHub Actions as their runtime. They bring more automation with broader permissions, started by more events and influenced by more untrusted input, and all of it runs on the foundation described in this article. The protections of the past year are available today, but most of them only take effect in your organisation once you enable them.&lt;/p&gt;




&lt;h3&gt;
  
  
  Sidebar: If you publish actions
&lt;/h3&gt;

&lt;p&gt;Everyone who uses your action depends on how well you protect your repository.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Require two-factor authentication for every maintainer.&lt;/li&gt;
&lt;li&gt;Protect your version tags and release branches with rulesets, and prevent others from creating branches that look like version tags.&lt;/li&gt;
&lt;li&gt;Enable immutable releases and republish your existing releases to lock them.&lt;/li&gt;
&lt;li&gt;Keep the default token read-only.&lt;/li&gt;
&lt;li&gt;Pin your own dependencies, including &lt;code&gt;npx&lt;/code&gt; calls in your scripts.&lt;/li&gt;
&lt;li&gt;Reference actions in your own repository with &lt;code&gt;$/&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Attach an attestation to every release.&lt;/li&gt;
&lt;li&gt;Run GitHub Advanced Security for Actions or zizmor on your own workflows.&lt;/li&gt;
&lt;li&gt;Use the egress firewall to control and monitor outbound network traffic from your workflows.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My trust checklist lists these as signals that users should check before they adopt an action.&lt;/p&gt;

&lt;h3&gt;
  
  
  Further reading
&lt;/h3&gt;




&lt;ol&gt;
&lt;li id="fn1"&gt;
&lt;p&gt;Security Lab, "Preventing pwn requests": securitylab.github.com/resources/github-actions-preventing-pwn-requests ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn2"&gt;
&lt;p&gt;Akamai, "Mini Shai-Hulud: The Worm Returns and Goes Public": akamai.com/blog/security-research/mini-shai-hulud-worm-returns-goes-public ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn3"&gt;
&lt;p&gt;GitHub Actions 2026 security roadmap: github.blog/news-insights/product-news/whats-coming-to-our-github-actions-2026-security-roadmap ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn4"&gt;
&lt;p&gt;"Towards a secure by default GitHub Actions": github.com/orgs/community/discussions/179107 ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn5"&gt;
&lt;p&gt;About Actions policies: docs.github.com/actions/concepts/about-actions-policies ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn6"&gt;
&lt;p&gt;A trust checklist for GitHub Actions: jessehouwing.net/a-trust-checklist-for-github-actions ↩︎ ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn7"&gt;
&lt;p&gt;jessehouwing/actions-semver-checker: github.com/jessehouwing/actions-semver-checker ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn8"&gt;
&lt;p&gt;github/gh-actions-lock: github.com/github/gh-actions-lock ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn9"&gt;
&lt;p&gt;Improved dependency submission for GitHub Actions: jessehouwing.net/github-actions-improved-dependency-submission ↩︎ ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn10"&gt;
&lt;p&gt;Native egress firewall: github.com/github-early-access/actions-native-egress-firewall ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn11"&gt;
&lt;p&gt;actions/create-github-app-token: github.com/actions/create-github-app-token ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn12"&gt;
&lt;p&gt;zizmor: docs.zizmor.sh ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn13"&gt;
&lt;p&gt;GitHubSecurityLab/actions-permissions: github.com/GitHubSecurityLab/actions-permissions ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn14"&gt;
&lt;p&gt;Security hardening for GitHub Actions: docs.github.com/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn15"&gt;
&lt;p&gt;actions/dependency-review-action: github.com/actions/dependency-review-action ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn16"&gt;
&lt;p&gt;Immutable subject claims for GitHub Actions OIDC tokens: github.blog/changelog/2026-04-23-immutable-subject-claims-for-github-actions-oidc-tokens ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;li id="fn17"&gt;
&lt;p&gt;Actions OIDC tokens now support repository custom properties: github.blog/changelog/2026-03-12-actions-oidc-tokens-now-support-repository-custom-properties ↩︎&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>githubactions</category>
      <category>supplychainsecurity</category>
      <category>github</category>
    </item>
    <item>
      <title>Fixing complex bugs with AI - A deepdive into the PowerShellScriptAnalyzer</title>
      <dc:creator>Jesse Houwing</dc:creator>
      <pubDate>Thu, 17 Sep 2026 22:01:50 +0000</pubDate>
      <link>https://dev.to/jessehouwing/fixing-complex-bugs-with-ai-a-deepdive-into-the-powershellscriptanalyzer-38pj</link>
      <guid>https://dev.to/jessehouwing/fixing-complex-bugs-with-ai-a-deepdive-into-the-powershellscriptanalyzer-38pj</guid>
      <description>&lt;p&gt;&lt;a href="https://www.flickr.com/photos/mountainroamerimages/6458518567" rel="noopener noreferrer"&gt;Down the Rabbit Hole&lt;/a&gt; - &lt;a href="https://www.flickr.com/photos/mountainroamerimages/" rel="noopener noreferrer"&gt;Susan Dussaman&lt;/a&gt; - &lt;a href="https://creativecommons.org/licenses/by-sa/2.0/" rel="noopener noreferrer"&gt;CC BY-SA 2.0&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Some build failures are annoying. Others are simply impossible. Mine was the second kind.&lt;/p&gt;

&lt;p&gt;On a plain &lt;code&gt;ubuntu-latest&lt;/code&gt; runner, a recursive &lt;code&gt;Invoke-ScriptAnalyzer&lt;/code&gt; run would stop dead with an error saying that &lt;code&gt;Get-Command&lt;/code&gt; was not recognised as the name of a cmdlet. Not some obscure module. Not a typo in a script. &lt;code&gt;Get-Command&lt;/code&gt;. The single most fundamental discovery cmdlet in PowerShell, missing from PowerShell.&lt;/p&gt;

&lt;p&gt;The same workflow had been perfectly happy on PSScriptAnalyzer 1.24. The only thing that changed was the analyser version.&lt;/p&gt;

&lt;p&gt;What follows is the story of &lt;a href="https://github.com/PowerShell/PSScriptAnalyzer/pull/2206?ref=jessehouwing.net" rel="noopener noreferrer"&gt;PR #2206&lt;/a&gt;. It started as a bug fix, turned into a performance project, and nearly became a pile of AI-generated slop. Along the way, AI tooling helped me, led me in the wrong direction, and showed that getting the code ready is not the same as getting it released.&lt;/p&gt;

&lt;h2&gt;
  
  
  It starts because it is open source
&lt;/h2&gt;

&lt;p&gt;The broken workflow was mine. It was &lt;a href="https://github.com/jessehouwing/actions-semver-checker?ref=jessehouwing.net" rel="noopener noreferrer"&gt;actions-semver-checker&lt;/a&gt;, one of the small projects I maintain, and the only change in the failing pull request was the pinned analyser version. So I filed &lt;a href="https://github.com/PowerShell/PSScriptAnalyzer/issues/2205?ref=jessehouwing.net" rel="noopener noreferrer"&gt;issue #2205&lt;/a&gt; with links to both runs.&lt;/p&gt;

&lt;p&gt;This is easy to take for granted.&lt;/p&gt;

&lt;p&gt;In most of my working life, that would have been the end of my involvement. You raise a ticket. You attach logs. You wait. Somebody you will never meet triages it against priorities you cannot see, and your only remaining move is to pin to the last version that worked and hope the next release quietly fixes it. You are a spectator to a problem that is costing &lt;em&gt;you&lt;/em&gt; time.&lt;/p&gt;

&lt;p&gt;Here I could carry on. The repository is public, so I cloned it, diffed 1.24 against 1.25, and had a source-level diagnosis in the issue within twenty minutes: &lt;code&gt;AvoidAlias&lt;/code&gt; asks the engine about every non-alias command it sees; that question travels through &lt;code&gt;CommandInfoCache&lt;/code&gt;, which used a pool of child runspaces and ran &lt;code&gt;Get-Command&lt;/code&gt; inside them via &lt;code&gt;PowerShell.Create()&lt;/code&gt;; PR #2125 had recently taught that path to parse &lt;code&gt;Module\Command&lt;/code&gt; and pass &lt;code&gt;-Module&lt;/code&gt; along, and the build reference for &lt;code&gt;System.Management.Automation&lt;/code&gt; had moved from 7.4.7 to 7.4.14.&lt;/p&gt;

&lt;p&gt;So the error had a fairly ordinary cause. We were not losing &lt;code&gt;Get-Command&lt;/code&gt; from PowerShell. We were losing it from &lt;em&gt;our own child runspace&lt;/em&gt;, under concurrency, on a machine with a particular set of modules on disk.&lt;/p&gt;

&lt;p&gt;In that first write-up I was careful about what I could not prove. My repository does not use module-qualified invocations, so I could not show that #2125 alone caused it. I could only show that it was the most likely place to look. It is important to keep measurements and suspicions separate.&lt;/p&gt;

&lt;p&gt;No support ticket or NDA. I could read the code, form a theory, write a test and open a pull request. That ability to take ownership is one of the main reasons open source matters.&lt;/p&gt;

&lt;h2&gt;
  
  
  The first fix was the obvious one, and it was not enough
&lt;/h2&gt;

&lt;p&gt;My first instinct was containment. Catch the transient failure, return &lt;code&gt;null&lt;/code&gt;, and let the rules follow their existing "I could not resolve that command" path. A failed lookup should not take down an entire analysis run.&lt;/p&gt;

&lt;p&gt;One detail mattered: the cache stored &lt;code&gt;Lazy&amp;lt;CommandInfo&amp;gt;&lt;/code&gt; values, and &lt;code&gt;Lazy&amp;lt;T&amp;gt;&lt;/code&gt; caches exceptions as well as results. One unlucky lookup would poison that entry for the rest of the process. So the fix evicted only the faulted entry rather than clearing everything.&lt;/p&gt;

&lt;p&gt;Then I went a step further and serialised all command lookups onto a single dedicated runspace behind a lock. If the engine is not thread-safe here, stop being concurrent here.&lt;/p&gt;

&lt;p&gt;That felt like the answer. It compiled, the tests went green, and the original failure disappeared.&lt;/p&gt;

&lt;p&gt;It was not the answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The review that changed the question
&lt;/h2&gt;

&lt;p&gt;Twenty-six days later, one of the maintainers replied. And in a few short paragraphs he handed me a pile of context I had no way of acquiring on my own.&lt;/p&gt;

&lt;p&gt;He told me this was not the first time &lt;code&gt;CommandInfoCache&lt;/code&gt; had produced concurrency issues — there had been several, over a period, from different reporters. He told me the root cause as the maintainers understood it was PowerShell engine internals not being thread-safe, which turned my careful hedge ("I cannot prove #2125 alone triggers this") into a settled question. He pointed me at an attempt to fix it on the PowerShell side. And he mentioned, almost in passing, that he had previously seen lock-based optimisations in this area degrade performance badly by removing concurrency.&lt;/p&gt;

&lt;p&gt;I want to be fair about what I could have found on my own. Working through the 1.24-to-1.25 diff revealed links to the PowerShell runtime repository, where the underlying concurrency problems are documented.&lt;/p&gt;

&lt;p&gt;What he added was the knowledge that had not been written down. This was not a one-off. The maintainers already agreed on the likely cause. Most importantly, a previous lock-based fix had made this code much slower. It was tried and abandoned, so there was no merged change for me to find.&lt;/p&gt;

&lt;p&gt;He did not replace a day's research with five minutes of magic. He gave that research context that only a long-serving maintainer had. He told me which questions were already settled, which ideas had caused trouble before, and where the real risk was.&lt;/p&gt;

&lt;p&gt;Then he asked for one specific thing.&lt;/p&gt;

&lt;p&gt;Analyse PowerShell's own &lt;code&gt;build.psm1&lt;/code&gt; in a freshly started shell, then immediately again in that same shell. Do it for my branch and for the implementation in 1.25. Post the numbers.&lt;/p&gt;

&lt;p&gt;Those two measurements matter because PSScriptAnalyzer gets used in two very different ways, and the rest of this story hangs on the distinction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In a pipeline, it runs once.&lt;/strong&gt; A GitHub Actions job starts a runner, installs the module, runs &lt;code&gt;Invoke-ScriptAnalyzer -Recurse&lt;/code&gt;, and exits. Nothing is cached or warmed up. If it takes thirteen seconds instead of three, every contributor pays those ten seconds on every push and pull request. If it fails, the check is red and somebody has to find out why.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;In an editor, it keeps running.&lt;/strong&gt; The PowerShell extension in VS Code keeps the analyser alive in a background process and runs it again as you type. The first analysis after opening a workspace is a one-off start-up cost. After that, the caches are hot and .NET has optimised the busy code paths. Those later runs need to be fast and consistent, without warnings appearing and disappearing between keystrokes.&lt;/p&gt;

&lt;p&gt;So the benchmark measures both situations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;The first run in a fresh process&lt;/strong&gt; stands in for the CI job. It is the number most users experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The immediate repeat run in the same process&lt;/strong&gt; stands in for the editor. It shows what happens once everything is populated and optimised.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The two numbers can move in opposite directions. Aggressive caching makes the second look good at the expense of the first. Serialising everything behind a lock — my fix — protected correctness but made the first run much slower. Non-determinism is also easy to miss in timings: in an editor, it becomes a warning that appears and disappears while you work.&lt;/p&gt;

&lt;p&gt;Keep that trap in mind, because I walked straight into it later on and very nearly shipped the result.&lt;/p&gt;

&lt;p&gt;(In the pull request I call these the cold and warm runs.)&lt;/p&gt;

&lt;p&gt;He had seen this type of fix go wrong before and asked for the cheapest experiment that would settle the question.&lt;/p&gt;

&lt;p&gt;At that point the pull request stopped being "can we make it stop crashing" and became "can we make it stop crashing at a cost anyone would accept". The information that changed the work was not in the repository. It came from a person.&lt;/p&gt;

&lt;p&gt;The review was the most valuable input I received in the entire project. A maintainer is not an obstacle between you and a merge.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building a benchmark
&lt;/h2&gt;

&lt;p&gt;So I built a benchmark. Not a stopwatch in a script — an isolated GitHub Actions matrix across Ubuntu and Windows, analysing two real projects (the PowerShell repository itself, and &lt;code&gt;actions-semver-checker&lt;/code&gt;, the very repository that had started all this), timing both the fresh-process run and the immediate repeat, and taking a SHA256 fingerprint of the normalised findings so I could prove the analyser's &lt;em&gt;output&lt;/em&gt; had not changed while its timings did.&lt;/p&gt;

&lt;p&gt;Every comparison from here on is my branch against the implementation in 1.25, built from source in the same job, on the same runner, analysing the same files.&lt;/p&gt;

&lt;p&gt;Then the benchmark told me my solution was bad.&lt;/p&gt;

&lt;p&gt;Analysing the PowerShell repository in a fresh process, 1.25 took 7.45 to 8.12 seconds. My branch took 25.90 to 27.54. On the semver project, 9.49–12.76 seconds became 33.55–36.80. Repeat runs in the same process were fine, even slightly better. But the fresh-process runs — the ones that represent almost every real use — were roughly three times slower.&lt;/p&gt;

&lt;p&gt;The maintainer's response was pragmatic: perhaps make it an opt-in switch, so people who need determinism can pay for it and people who need throughput can keep their concurrency.&lt;/p&gt;

&lt;p&gt;I did not want to ship that compromise. A correctness fix that you have to opt into is a correctness fix most people will never get.&lt;/p&gt;

&lt;p&gt;There was one encouraging result in that matrix. The 1.25 samples kept failing and needing reruns. Mine never did. The benchmark had also become a determinism test.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it nearly became slop
&lt;/h2&gt;

&lt;p&gt;The middle of the project is not the part people usually publish.&lt;/p&gt;

&lt;p&gt;Over a few hours on 14 September, the branch gained retry loops, telemetry counters, two build variants, per-rule exception handling and a summary job for the growing matrix. I then had to fix the matrix because a later change overwrote the results and made the retry variants indistinguishable.&lt;/p&gt;

&lt;p&gt;Every change was reasonable on its own. Copilot produced several of them quickly from a clear brief. I ran eleven separate agent tasks on my fork; eight were merged and three were closed as superseded. I would not have explored half as many directions without it.&lt;/p&gt;

&lt;p&gt;But I had built an increasingly complex system for &lt;em&gt;recovering from&lt;/em&gt; the problem, followed by another system for measuring the recovery. The diff and test suite kept growing, while none of it addressed why we were doing something dangerous in the first place.&lt;/p&gt;

&lt;p&gt;This is what I mean by a vibe-coded mess. The individual changes were not bad code and could have passed review on their own. The problem was the direction: an agent will keep adding layers unless you stop and ask a different question.&lt;/p&gt;

&lt;p&gt;The numbers did not improve enough to justify the complexity.&lt;/p&gt;

&lt;p&gt;So I deleted it. Retries, telemetry, build variants, rule-level catches — all of it came out in one commit. The repository-wide regression test, which the automated reviewer had flagged as depending on whatever happened to be in the repo, was replaced by a small, self-contained test that hammers the rules in parallel. The branch got smaller for the first time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Asking a different question
&lt;/h2&gt;

&lt;p&gt;With the scaffolding gone, I went back to instrumenting, but this time to answer one question: why are we calling into PowerShell so much?&lt;/p&gt;

&lt;p&gt;The answer was stark.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;failed&lt;/strong&gt; &lt;code&gt;Get-Command&lt;/code&gt; lookup cost around 59 ms. A hit cost around 0.8 ms. Seventy-four times more expensive, because a miss sends PowerShell off to autodiscover modules across the entire &lt;code&gt;PSModulePath&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;On a real 111-file repository, 170 of 223 lookups — 76% — resolved to nothing. Those misses accounted for roughly 77% of total runtime.&lt;/li&gt;
&lt;li&gt;Priming the cache did not help. &lt;code&gt;Get-Command *&lt;/code&gt; took 78 seconds to enumerate around 116,000 commands, and later misses were no faster because PowerShell does not cache negative lookups.&lt;/li&gt;
&lt;li&gt;The cache was already shared across &lt;code&gt;Invoke-ScriptAnalyzer&lt;/code&gt; calls within a process. A second analysis in the same session performed zero lookups. The editor case was already in good shape. &lt;strong&gt;The pipeline case — one analysis, from nothing — was the whole problem.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the expensive operation was not "look up a command". It was "look up a command that does not exist". And once you frame it that way, the question becomes: which of these 170 non-existent commands should we never have asked about?&lt;/p&gt;

&lt;p&gt;That turned out to be a much better question, and the answers were not performance bugs. They were correctness bugs that happened to be slow.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four lookups we should never have made
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Probing &lt;code&gt;Get-&lt;/code&gt; in front of a hyphenated name.&lt;/strong&gt; &lt;code&gt;AvoidAlias&lt;/code&gt; has a sensible fallback: if it sees &lt;code&gt;process&lt;/code&gt;, it tries &lt;code&gt;Get-Process&lt;/code&gt;. But for an unrecognised &lt;code&gt;Test-ActionInput&lt;/code&gt; it produced &lt;code&gt;Get-Test-ActionInput&lt;/code&gt;, which matched none of the 116,289 commands on my machine and doubled the cost of every miss.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ignoring functions the script itself defines.&lt;/strong&gt; If my script defines its own &lt;code&gt;Get-ChildItem&lt;/code&gt;, the analyser was resolving that name against the cmdlet installed on &lt;em&gt;my&lt;/em&gt; machine. &lt;code&gt;UseCorrectCasing&lt;/code&gt; could then advise me to rename a function based on a command my script deliberately shadows. Collecting &lt;code&gt;FunctionDefinitionAst&lt;/code&gt; names once per analysis fixed the advice and removed many 59 ms misses at the same time.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Treating member names as commands.&lt;/strong&gt; &lt;code&gt;UseShouldProcessCorrectly&lt;/code&gt; built a call graph with a vertex for every invocation member, so &lt;code&gt;$x.Substring(1)&lt;/code&gt; triggered &lt;code&gt;Get-Command Substring&lt;/code&gt;. Worse, &lt;code&gt;$dir.mkdir()&lt;/code&gt; could be &lt;em&gt;credited&lt;/em&gt; with &lt;code&gt;SupportsShouldProcess&lt;/code&gt;, because &lt;code&gt;mkdir&lt;/code&gt; happens to exist as a PowerShell function on Windows. A method call was being scored against an unrelated cmdlet. Tagging vertices reached through genuine command invocation fixed the semantics and the cost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Forgetting that modules dot-source themselves.&lt;/strong&gt; A function in one library file routinely calls a function defined in a sibling file, with no import visible in either. I grouped files by directed dot-source relationship and gave each file the functions reachable through its own dot-source closure — deliberately &lt;em&gt;not&lt;/em&gt; merging entire connected components, so a test script that dot-sources one library does not inherit functions from its siblings.&lt;/p&gt;

&lt;p&gt;That last one took a 111-file module from 13.5 seconds to 2.9 in a fresh process. Repeat runs unchanged. Findings identical.&lt;/p&gt;

&lt;p&gt;Then I removed the instrumentation counters. They had done their job.&lt;/p&gt;

&lt;h2&gt;
  
  
  The complete list of fixes
&lt;/h2&gt;

&lt;p&gt;Here is the full set, sorted by the kind of problem it is.&lt;/p&gt;

&lt;h3&gt;
  
  
  Threading and lifetime bugs
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Concurrent use of a non-thread-safe engine surface.&lt;/strong&gt; &lt;code&gt;CommandInfoCache&lt;/code&gt; resolved commands through a &lt;em&gt;pool&lt;/em&gt; of child runspaces, each running &lt;code&gt;Get-Command&lt;/code&gt; via &lt;code&gt;PowerShell.Create()&lt;/code&gt;. PowerShell's command-discovery internals are not safe to drive this way from multiple threads. The symptoms included &lt;code&gt;CommandNotFoundException&lt;/code&gt; for &lt;code&gt;Get-Command&lt;/code&gt; itself, null reference exceptions, pipeline creation failures, even process aborts and hangs in PowerShell 5.1. The pool is replaced with one dedicated runspace behind a re-entrant lock.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Lazy&amp;lt;T&amp;gt;&lt;/code&gt; exception poisoning.&lt;/strong&gt; The cache stored &lt;code&gt;Lazy&amp;lt;CommandInfo&amp;gt;&lt;/code&gt; values, and &lt;code&gt;Lazy&amp;lt;T&amp;gt;&lt;/code&gt; caches the exception just as faithfully as it caches a result. One transient failure permanently poisoned that command for the rest of the process, so a momentary race became a persistent wrong answer. Now only the faulted entry is evicted — and crucially, &lt;em&gt;genuine&lt;/em&gt; negative results are still cached, so "this command really does not exist" does not become a repeated 59 ms lookup.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Unsynchronised disposal.&lt;/strong&gt; The disposal paths did not take the runspace lock, so teardown could race an in-flight lookup. Both paths now lock.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Metadata access escaping the lock.&lt;/strong&gt; Even with lookups serialised, rules were reaching back into the engine afterwards — resolving parameters on a &lt;code&gt;CommandInfo&lt;/code&gt; re-enters PowerShell on the caller's thread, outside the protection. Metadata reads are now serialised alongside the lookups through a &lt;code&gt;Func&amp;lt;CommandInfo, T&amp;gt;&lt;/code&gt; callback, and static export metadata is used in preference to dynamic parameter resolution where it is available.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Get-Command&lt;/code&gt; resolved by unqualified name.&lt;/strong&gt; The internal call used the bare name, which is itself subject to shadowing and discovery failure. It is now fully qualified as &lt;code&gt;Microsoft.PowerShell.Core\Get-Command&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Non-deterministic output as a consequence.&lt;/strong&gt; All of the above combined into the symptom that bothers me most: the same input produced 154, 155 or 157 findings depending on which lookups happened to lose a race. In a pipeline that means a build that fails on a rerun of an unchanged commit. In an editor it means warnings that appear and vanish while you type. Static analysis that is not reproducible is not much use in either.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The analyser could also crash.&lt;/strong&gt; This is what users saw.&lt;/p&gt;

&lt;p&gt;Your check goes red with an error saying &lt;code&gt;Get-Command&lt;/code&gt; does not exist. Nothing in that message points at the analyser's internals. You re-read your own diff and wonder whether the runner image changed, a module failed to install, or PowerShell itself is broken. Eventually you rerun the job. A fresh run succeeded between 55 and 59 times out of 100, so it may turn green without explaining anything.&lt;/p&gt;

&lt;p&gt;When that happens often enough, people pin to an older version, add &lt;code&gt;continue-on-error&lt;/code&gt;, exclude the rule, or remove the analyser from the pipeline. That is what I did first: I reverted to 1.24 and continued with other work. People rarely file an issue to say they have stopped using your tool. An unreliable check can leave you with silence and a linter nobody trusts.&lt;/p&gt;

&lt;h3&gt;
  
  
  Logic and semantic bugs
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Script-defined functions did not shadow installed commands.&lt;/strong&gt; If a script defined its own &lt;code&gt;Get-ChildItem&lt;/code&gt;, the analyser resolved that name against whatever was installed on the machine running the analysis. &lt;code&gt;UseCorrectCasing&lt;/code&gt; would then recommend casing taken from a cmdlet the script deliberately overrides. The analyser was modelling the host instead of the code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dot-sourced siblings were invisible.&lt;/strong&gt; The same bug at module scale. A library file calling a function defined in a sibling file — the normal way a PowerShell module composes itself — resolved against the host rather than the module. Fixed by giving each file the functions reachable through its directed dot-source closure, deliberately &lt;em&gt;without&lt;/em&gt; merging whole connected components, so a test script that dot-sources one library does not inherit unrelated siblings' functions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Member names were resolved as commands.&lt;/strong&gt; &lt;code&gt;UseShouldProcessCorrectly&lt;/code&gt; created a call-graph vertex for every invocation member, so &lt;code&gt;$x.Substring(1)&lt;/code&gt; produced a &lt;code&gt;Get-Command Substring&lt;/code&gt;. The real damage was the false negative: &lt;code&gt;$dir.mkdir()&lt;/code&gt; was credited with &lt;code&gt;SupportsShouldProcess&lt;/code&gt;, because &lt;code&gt;mkdir&lt;/code&gt; exists as a PowerShell function on Windows. A method call was silently scored against an unrelated cmdlet, and a rule violation went unreported. Only vertices reached through genuine command invocation are resolved now.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The &lt;code&gt;Get-&lt;/code&gt; prefix probe applied to hyphenated names.&lt;/strong&gt; The fallback exists to turn &lt;code&gt;process&lt;/code&gt; into &lt;code&gt;Get-Process&lt;/code&gt;. Applied to an unresolved &lt;code&gt;Test-ActionInput&lt;/code&gt; it asked about &lt;code&gt;Get-Test-ActionInput&lt;/code&gt;, which matches none of the 116,289 discoverable commands on my machine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A rule's own test fixture was passing for the wrong reason.&lt;/strong&gt; A fixture declared &lt;code&gt;SupportsShouldProcess&lt;/code&gt; and never called &lt;code&gt;ShouldProcess&lt;/code&gt;, which should be a violation. But it defined a local &lt;code&gt;Set-Service&lt;/code&gt; that was resolved as the system cmdlet, masking the result. The shadowing fix exposed that false negative in the test suite.&lt;/p&gt;

&lt;h3&gt;
  
  
  Performance problems
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Failed lookups dominated the fresh-process run.&lt;/strong&gt; 59 ms for a miss against 0.8 ms for a hit, because a miss sends PowerShell autodiscovering modules across the whole &lt;code&gt;PSModulePath&lt;/code&gt;. On a real 111-file repository, 170 of 223 lookups resolved to nothing — 76% of the calls, roughly 77% of the runtime.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Every semantic fix above is also a performance fix.&lt;/strong&gt; Script-local and dot-source resolution answer from the syntax tree instead of the engine. Dropping the &lt;code&gt;Get-&lt;/code&gt; probe halves the cost of the misses that remain. Not resolving member names removes an entire category of lookup that was never meaningful. The speedup comes from &lt;em&gt;asking fewer questions&lt;/em&gt;, not from answering them faster.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Files are parsed once per run.&lt;/strong&gt; The dot-source pre-pass retains the syntax trees it builds rather than discarding them, so a recursive analysis no longer reparses. &lt;code&gt;-Fix&lt;/code&gt; opts out, because it rewrites each file before analysing it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Serialisation stopped mattering.&lt;/strong&gt; The lock cost that made fresh-process runs three times slower in September is still there — I did not remove it, it is what makes the analysis deterministic. It simply stopped being on the hot path once lookup volume collapsed.&lt;/p&gt;

&lt;p&gt;One thing is deliberately not changed: parameter and metadata re-evaluation. I assumed it was a bottleneck, but instrumentation showed around 97 lock acquisitions per pass. It was not worth optimising.&lt;/p&gt;

&lt;h2&gt;
  
  
  The trade I nearly accepted
&lt;/h2&gt;

&lt;p&gt;By this point I was pleased with the progress.&lt;/p&gt;

&lt;p&gt;The pipeline case had gone from thirteen and a half seconds to under three. That was the number I had been chasing since the maintainer's review, it was the number in the issue that started all this, and it was the number almost every user would feel. I had been staring at it for days.&lt;/p&gt;

&lt;p&gt;The editor case, meanwhile, was a couple of seconds slower on repeat runs. I started telling myself that was fine: CI pays for the first run on every push, while a second or two in a long-lived editor session is barely noticeable. A four-times improvement in CI for a small editor regression seemed acceptable.&lt;/p&gt;

&lt;p&gt;But it was the trade I had told myself not to make when I decided to measure both cases. It is easy to ignore a principle when one of the numbers looks so good.&lt;/p&gt;

&lt;p&gt;I would have had to explain that trade-off to a maintainer who had already warned me about regressions in this area. Instead of arguing it away, I investigated it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The benchmark was lying to me, twice
&lt;/h2&gt;

&lt;p&gt;Two things then made the harness itself the suspect.&lt;/p&gt;

&lt;p&gt;The repeat-run numbers looked like a regression, but the first run wrote its findings to disk &lt;em&gt;before&lt;/em&gt; the second measurement began. Garbage collection for those allocations landed on the second run's clock. Running a collection before each timed run removed this effect.&lt;/p&gt;

&lt;p&gt;The second problem was less obvious. Once the fresh-process run became three times faster, the second run was no longer a steady state. .NET starts with quick, unoptimised code and recompiles methods after enough use. That work used to fit inside a 13-second first pass. Now it continued into passes two and three, so my "fully warmed up" run was still warming up. A few discarded analyses before the measurement also removed this effect. Disabling tiered compilation confirmed the cause: in that case the second pass was already stable.&lt;/p&gt;

&lt;p&gt;The lesson applies beyond this project: &lt;strong&gt;a benchmark is software, with its own bugs.&lt;/strong&gt; Improving the product had invalidated assumptions in the measurement.&lt;/p&gt;

&lt;p&gt;Chasing the repeat-run numbers also revealed work the analyser repeated &lt;em&gt;after&lt;/em&gt; everything was cached: files were reparsed and lookups repeated. Almost all of that work also happened on the first run, so improving the editor case improved the pipeline case too.&lt;/p&gt;

&lt;p&gt;The regression was not the price of a faster first run. It showed that I had more work to remove. I did not foresee that; I found it because I was unwilling to accept the regression.&lt;/p&gt;

&lt;h2&gt;
  
  
  Evidence reviewers can check
&lt;/h2&gt;

&lt;p&gt;My concern with AI-assisted open source contributions is not the code but the &lt;em&gt;claims&lt;/em&gt;. A pull request saying "fixes a race condition, improves performance" gives a maintainer little they can verify.&lt;/p&gt;

&lt;p&gt;So I set out to produce evidence that a reviewer could check without trusting me.&lt;/p&gt;

&lt;p&gt;The final cross-platform CI results. "First run" is a freshly started process analysing the project once; "repeat run" is a second analysis immediately afterwards in that same process.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Operating system&lt;/th&gt;
&lt;th&gt;Project analysed&lt;/th&gt;
&lt;th&gt;First run, 1.25&lt;/th&gt;
&lt;th&gt;First run, this PR&lt;/th&gt;
&lt;th&gt;Repeat run, 1.25&lt;/th&gt;
&lt;th&gt;Repeat run, this PR&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Ubuntu&lt;/td&gt;
&lt;td&gt;PowerShell&lt;/td&gt;
&lt;td&gt;6.62 s&lt;/td&gt;
&lt;td&gt;2.80 s&lt;/td&gt;
&lt;td&gt;0.10 s&lt;/td&gt;
&lt;td&gt;0.11 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ubuntu&lt;/td&gt;
&lt;td&gt;semver checker&lt;/td&gt;
&lt;td&gt;12.92 s&lt;/td&gt;
&lt;td&gt;5.21 s&lt;/td&gt;
&lt;td&gt;1.96 s&lt;/td&gt;
&lt;td&gt;1.82 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Windows&lt;/td&gt;
&lt;td&gt;PowerShell&lt;/td&gt;
&lt;td&gt;8.49 s&lt;/td&gt;
&lt;td&gt;2.60 s&lt;/td&gt;
&lt;td&gt;0.10 s&lt;/td&gt;
&lt;td&gt;0.07 s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Windows&lt;/td&gt;
&lt;td&gt;semver checker&lt;/td&gt;
&lt;td&gt;12.96 s&lt;/td&gt;
&lt;td&gt;6.52 s&lt;/td&gt;
&lt;td&gt;2.29 s&lt;/td&gt;
&lt;td&gt;2.23 s&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The pipeline case is two to three times faster, while the editor case is unchanged or slightly better. What looked like a trade-off was work I had not removed yet.&lt;/p&gt;

&lt;p&gt;On the 111-file project across two CI attempts, 1.25 crashed 27 times. The runs that survived reported 154, 155, or &lt;em&gt;157&lt;/em&gt; findings for the same input. The proposed changes completed all 40 measurements and always produced the same fingerprint and 154 findings. One caveat: the benchmark retries 1.25's failures which also means the timings exclude its worst runs and make it look faster than it actually is.&lt;/p&gt;

&lt;p&gt;I proceeded with local stress testing, 100 freshly started processes per configuration: 1.25 succeeded 59 times out of 100 on PowerShell 7.6.6, and 55 out of 100 on Windows PowerShell 5.1. With the proposed changes applied: 100 out of 100 in both. Across 400 analyses in total, 86 runs of 1.25 died outright — 58 command-not-found errors, 22 null references, several pipeline creation errors, two process aborts and two timeouts. All of those signatures went into the PR description, because "it crashes sometimes" is an anecdote and a list of distinct failure modes is evidence.&lt;/p&gt;

&lt;p&gt;One experiment also justified deleting the retry code. In 100 freshly started PowerShell 7 sessions, 35 hit a caught failure on their first attempt. Twelve recovered later in the same session. Twenty-three kept failing until a 120-second cut-off. &lt;strong&gt;Retrying is not recovery when the failure may have corrupted the state you are retrying in.&lt;/strong&gt; Twelve recoveries out of thirty-five failures is not a reliable strategy. I only know that because I measured it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Build and test problems along the way
&lt;/h2&gt;

&lt;p&gt;This project also took many hours on things that had nothing to do with the bug but were necessary to work on it.&lt;/p&gt;

&lt;p&gt;The build pins .NET SDK 8.0.4xx, and having SDK 10 installed does not help. Building with &lt;code&gt;-PSVersion 7&lt;/code&gt; produces only the net8 output; the module root DLL is the net462 build that Windows PowerShell 5.1 loads, and it stays stale until you build &lt;code&gt;-All&lt;/code&gt;. I spent some time investigating why fixed code still failed before I understood that.&lt;/p&gt;

&lt;p&gt;My editor's built-in test runner was worse than useless here, because it runs Pester without importing the repository build — so &lt;code&gt;Invoke-ScriptAnalyzer&lt;/code&gt; silently resolved to the globally installed PSScriptAnalyzer. The symptom is beautifully misleading: your new behaviour tests fail while every control test passes. The fix is to replicate the harness and prepend &lt;code&gt;out&lt;/code&gt; to &lt;code&gt;PSModulePath&lt;/code&gt; explicitly.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;PSUseCorrectCasing&lt;/code&gt; is a configurable rule and is off by default, so &lt;code&gt;-IncludeRule&lt;/code&gt; alone does not switch it on. For A/B comparisons, build the baseline in a &lt;code&gt;git worktree&lt;/code&gt; rather than stashing; otherwise it is easy to lose track of which build is running. Test fixtures that use &lt;code&gt;Add-Type&lt;/code&gt; must also be C# 5 compatible, because the compiler Windows PowerShell 5.1 uses rejects null-conditional operators and expression-bodied members.&lt;/p&gt;

&lt;p&gt;These detours are often called yak shaving. Copilot handled much of it: it read build errors, found the SDK mismatch and noticed the stale module. Work that might have taken my evening happened while I did something else. But each loop used tokens, and the agent focused on the immediate problem rather than the state of the machine. It installed .NET 8 into a temporary folder at least five times before I noticed and installed it system-wide in about a minute. It had solved the local problem each time without asking why it kept returning.&lt;/p&gt;

&lt;p&gt;It also changed how I worked. I could start a task, do other work, check the result and correct the direction. I steered part of this project from my phone in a school car park while waiting to collect my kids.&lt;/p&gt;

&lt;p&gt;Those detours still had to be correct. The test runner using the globally installed module could have sent me changing code that was already right. This work is mostly invisible in the finished pull request, but it is a normal part of contributing to an established project. AI can handle much of it, but somebody still has to notice when it solves the same problem five times.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where AI helped
&lt;/h2&gt;

&lt;p&gt;Copilot was very good at bounded, well-specified work. Build an isolated benchmark matrix. Make this fixture cross-platform. Trace where these 106 unresolved lookups come from. Port this test to C# 5 syntax. With a clear brief and a way to verify the result, the agents produced work I merged with minor edits. They were also useful for the tedious middle of the investigation: another stress-test variation, readable result formatting, or broken links in a pull request description. The instrumentation that produced the 59 ms figure took minutes rather than an afternoon. That made the difference between running the experiment and deciding it was too much work.&lt;/p&gt;

&lt;p&gt;What it did not do was tell me when to stop. It did not question the four layers of retry machinery, notice that a local &lt;code&gt;Set-Service&lt;/code&gt; made a test pass for the wrong reason, or ask whether the repeat-run slowdown came from the product or the benchmark. I changed direction because the numbers looked wrong.&lt;/p&gt;

&lt;p&gt;Could an agent have got there by itself? Possibly. An agent reviewing a diff can identify these problems, and repeated review and revision can improve the result. I have not found a reliable way to know when that loop is finished. It may stop at a plausible answer or continue until it loses direction.&lt;/p&gt;

&lt;p&gt;That is why I kept steering it by hand. A few minutes deciding &lt;em&gt;where&lt;/em&gt; to look is cheaper than asking the machine to discover the direction. "Trace where these unresolved lookups come from" is targeted and verifiable. "Find out why this is slow and fix it" is open-ended and can use many tokens exploring ideas I could reject quickly. Often the human contribution is simply narrowing the search before the machine starts.&lt;/p&gt;

&lt;p&gt;This is the difference between vibe-coded code and code written with the same tools but properly reviewed. It is not the amount of code the model produced. It is whether the person directing it can ask a precise question. "Is the dot-source closure transitive, and should it be?" requires enough knowledge to understand why transitivity could be dangerous. Without that knowledge, you are left with "make it faster" and "fix the failing test", and may not be able to spot a plausible but wrong answer.&lt;/p&gt;

&lt;p&gt;Expertise can also narrow the questions you ask. I spent this project asking "why is this lookup happening?" and much less time asking "should command resolution work this way at all?" or "how would I design this today?". People familiar with a codebase tend to accept its existing shape. An agent does not, which can be annoying but also useful. Next time I want to spend some time asking the basic questions before I choose a direction.&lt;/p&gt;

&lt;p&gt;There is another limit: what an agent can know. An assistant &lt;em&gt;can&lt;/em&gt; read an issue tracker and follow links into another repository. That is how the PowerShell runtime issues behind this bug came to light.&lt;/p&gt;

&lt;p&gt;It cannot see what was never committed: an approach tried two years ago and abandoned because it halved throughput, or a conclusion a maintainer never wrote down. A repository records what survived, not everything that was attempted. A model can compare an approach with the code that exists. A maintainer can also tell you which ideas have failed before.&lt;/p&gt;

&lt;p&gt;AI made me much faster at producing possible solutions and &lt;em&gt;evidence&lt;/em&gt;. It did not decide which agent branches should survive, what to remove, or when the numbers were misleading. Without these tools, however, I would almost certainly never have done the work.&lt;/p&gt;

&lt;p&gt;This is not my job. It is a side project on somebody else's repository, fitted between client work, family and everything else. I was never going to spend three uninterrupted evenings fixing the build, writing a benchmark harness and running four hundred stress analyses by hand. I would have pinned to 1.24 and moved on. Instead I could work in twenty-minute pieces, with an agent continuing while I did something else.&lt;/p&gt;

&lt;p&gt;So the wasted tokens and repeated SDK installs need that context. The alternative was not a cleaner version of this pull request. It was no pull request, an unfixed bug, and a linter that a few more people might stop trusting.&lt;/p&gt;

&lt;h2&gt;
  
  
  The hard part comes next
&lt;/h2&gt;

&lt;p&gt;The technical work is nearly done. The crashes are gone, a first analysis in a fresh process is two to three times faster, and there is a benchmark anyone can rerun. Now it needs to be released.&lt;/p&gt;

&lt;p&gt;That carries risk. Three of the four main improvements are &lt;strong&gt;behavioural&lt;/strong&gt; changes to command resolution. Functions defined by a script now shadow installed cmdlets. Member invocations are no longer resolved as commands. Dot-sourced files now share their function definitions. These are fixes, but they also mean that some users will see different findings.&lt;/p&gt;

&lt;p&gt;Some of those differences are the whole point — the false &lt;code&gt;SupportsShouldProcess&lt;/code&gt; credit from &lt;code&gt;$dir.mkdir()&lt;/code&gt; should never have been there. But "we removed a false negative" reads very differently when it lands in your pipeline as a new build failure on a Friday afternoon.&lt;/p&gt;

&lt;p&gt;Then there are custom rules that I cannot see or test. I have checked the projects I can reach: internal ones, &lt;code&gt;actions-semver-checker&lt;/code&gt;, PSScriptAnalyzer's own build and test suite, and a handful of open source repositories. The results are consistent, but that is not proof.&lt;/p&gt;

&lt;h2&gt;
  
  
  So please go and break it
&lt;/h2&gt;

&lt;p&gt;This is where I need your help.&lt;/p&gt;

&lt;p&gt;If you use PSScriptAnalyzer in CI, in your editor, or with custom rules, please run the proposed build against your code and tell me what you find. Ten minutes of your time is worth more than another day of mine because I cannot test your code myself.&lt;/p&gt;

&lt;p&gt;Build it from the pull request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Install the .NET 8 SDK if you do not have it (on Linux/macOS: https://dot.net/download)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;winget&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;install&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Microsoft.DotNet.SDK.8&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# Requires the GitHub CLI&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;git&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;clone&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;https://github.com/PowerShell/PSScriptAnalyzer.git&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;Set-Location&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;PSScriptAnalyzer&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;gh&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;pr&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;checkout&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;2206&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# -All also builds the net462 output that Windows PowerShell 5.1 loads&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;/build.ps1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Configuration&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Release&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-All&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="nv"&gt;$proposed&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Resolve-Path&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;/out/PSScriptAnalyzer/1.25.0/PSScriptAnalyzer.psd1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Path&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="nv"&gt;$project&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'C:\src\your-project'&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then analyse your project twice, once with the version you use today and once with the proposed one, and compare the results. Use a fresh process for each so neither run can contaminate the other:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$analysis&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ModulePath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$ProjectPath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$OutputPath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="bp"&gt;$Error&lt;/span&gt;&lt;span class="n"&gt;ActionPreference&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;'Stop'&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nv"&gt;$temporaryPath&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$OutputPath&lt;/span&gt;&lt;span class="s2"&gt;.tmp"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;try&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="n"&gt;Import-Module&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$ModulePath&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Force&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-ErrorAction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Stop&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="n"&gt;Write-Host&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Analysing with PSScriptAnalyzer &lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Get-Module&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;PSScriptAnalyzer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;.Version)"&lt;/span&gt;&lt;span class="w"&gt;

        &lt;/span&gt;&lt;span class="c"&gt;# Collect everything before writing anything, so a failed run cannot leave a partial CSV.&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nv"&gt;$findings&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;@(&lt;/span&gt;&lt;span class="err"&gt;Invoke-ScriptAnalyzer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;-Path&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$ProjectPath&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;-Recurse&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;-ErrorAction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Stop&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="kr"&gt;try&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="n"&gt;New-Item&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$temporaryPath&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-ItemType&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;File&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Force&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Out-Null&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nv"&gt;$findings&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="n"&gt;Select-Object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;RuleName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Severity&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ScriptName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Line&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Message&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="n"&gt;Sort-Object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;RuleName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ScriptName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Line&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Column&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="n"&gt;Export-Csv&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$temporaryPath&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-NoTypeInformation&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-ErrorAction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Stop&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="n"&gt;Move-Item&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$temporaryPath&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$OutputPath&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Force&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="kr"&gt;finally&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="kr"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Test-Path&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$temporaryPath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="n"&gt;Remove-Item&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$temporaryPath&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Force&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-ErrorAction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;SilentlyContinue&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;catch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nv"&gt;$details&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;$_&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Out-String&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;Console&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="nx"&gt;Error.WriteLine&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$details&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="kr"&gt;exit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;exit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="kr"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;New-AnalyzerSnapshot&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$ModulePath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$OutputPath&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="n"&gt;Remove-Item&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$OutputPath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$OutputPath&lt;/span&gt;&lt;span class="s2"&gt;.tmp"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Force&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-ErrorAction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;SilentlyContinue&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;pwsh&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-NoProfile&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Command&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$analysis&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-args&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$ModulePath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$project&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$OutputPath&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$LASTEXITCODE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-ne&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="n"&gt;Remove-Item&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$OutputPath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$OutputPath&lt;/span&gt;&lt;span class="s2"&gt;.tmp"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Force&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-ErrorAction&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;SilentlyContinue&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="kr"&gt;throw&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"PSScriptAnalyzer failed with exit code &lt;/span&gt;&lt;span class="nv"&gt;$LASTEXITCODE&lt;/span&gt;&lt;span class="s2"&gt;. No comparison was made."&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# What you get today, followed by what you get with this pull request&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;New-AnalyzerSnapshot&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;PSScriptAnalyzer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="bp"&gt;$PWD&lt;/span&gt;&lt;span class="s2"&gt;/before.csv"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;New-AnalyzerSnapshot&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$proposed&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="bp"&gt;$PWD&lt;/span&gt;&lt;span class="s2"&gt;/after.csv"&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# Anything listed here is a behaviour change worth knowing about&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="n"&gt;Compare-Object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Import-Csv&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;/before.csv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Import-Csv&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;/after.csv&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;`
&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;-Property&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;RuleName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ScriptName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Line&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Column&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Message&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add &lt;code&gt;-CustomRulePath&lt;/code&gt; and &lt;code&gt;-Settings&lt;/code&gt; to the &lt;code&gt;Invoke-ScriptAnalyzer&lt;/code&gt; call if you use them. Those are the cases I can predict least and would most like to hear about.&lt;/p&gt;

&lt;p&gt;The longer script is deliberate. When I tested a simple pipeline against &lt;code&gt;actions-semver-checker&lt;/code&gt; using my installed 1.25 version, the baseline printed &lt;code&gt;The term 'Get-Command' is not recognized&lt;/code&gt;, exited with code 1, and still wrote 48 findings to &lt;code&gt;before.csv&lt;/code&gt;. The proposed build wrote 154. The apparent 106 additions were not behaviour changes; the failed run had dropped those findings. This script collects the complete result before replacing the CSV, deletes stale output, and stops if either analysis fails.&lt;/p&gt;

&lt;p&gt;Some differences are expected: a finding may disappear because a member call is no longer resolved as a command, casing advice may stop firing on a function defined by the script, or a new &lt;code&gt;PSUseShouldProcess&lt;/code&gt; warning may reveal a previous false negative. If something else changes — a rule stops working, a custom rule throws, a finding moves without a clear reason, or the analyser crashes — please report it on &lt;a href="https://github.com/PowerShell/PSScriptAnalyzer/pull/2206?ref=jessehouwing.net" rel="noopener noreferrer"&gt;PR #2206&lt;/a&gt;. The rule name and a small example are enough; you do not need to diagnose it.&lt;/p&gt;

&lt;p&gt;An identical result is useful too. "No change on a 300-file module with four custom rules" is real evidence, and I need more of it.&lt;/p&gt;

&lt;p&gt;Being able to suggest a fix to an open source project also means taking responsibility for what the fix does to its users. I can give the maintainers evidence, explain the behaviour changes, and respond when something breaks. I cannot test code I do not have.&lt;/p&gt;

&lt;p&gt;Generating code has become cheap. Earning a maintainer's trust has not. I would not want it to.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;&lt;a href="https://github.com/PowerShell/PSScriptAnalyzer/pull/2206?ref=jessehouwing.net" rel="noopener noreferrer"&gt;PR #2206&lt;/a&gt; is open at the time of writing. The benchmark workflow is on the branch, so you can run it yourself — and I would rather you did than take my word for any of the above.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>powershell</category>
      <category>githubcopilot</category>
      <category>ai</category>
      <category>debugging</category>
    </item>
    <item>
      <title>A trust checklist for GitHub Actions</title>
      <dc:creator>Jesse Houwing</dc:creator>
      <pubDate>Fri, 04 Sep 2026 17:09:14 +0000</pubDate>
      <link>https://dev.to/jessehouwing/a-trust-checklist-for-github-actions-4nck</link>
      <guid>https://dev.to/jessehouwing/a-trust-checklist-for-github-actions-4nck</guid>
      <description>&lt;p&gt;Every action you reference in a workflow runs on your runner, with access to your workspace and whatever token you hand it. &lt;code&gt;uses: some-org/some-action@v3&lt;/code&gt; is an instruction to execute someone else's code inside your CI environment. It deserves at least as much scrutiny as a production dependency, and usually receives considerably less.&lt;/p&gt;

&lt;p&gt;What follows is the checklist I use when assessing whether an action can be trusted. A caveat before the list: &lt;strong&gt;this is partly a wish list.&lt;/strong&gt; Some of these attributes are present on very few actions today. Not all of them can be detected automatically or queried through an API, and several require manual review or AI assistance to establish. Treat it as a set of weighted signals rather than a pass/fail gate.&lt;/p&gt;

&lt;p&gt;The list is split into two tiers: signals that carry real weight, and signals that are worth a glance but should not be decisive.&lt;/p&gt;




&lt;h2&gt;
  
  
  Tier 1: signals that carry weight
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Tooling and maintenance
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Signal&lt;/th&gt;
&lt;th&gt;How to verify&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The repository uses GitHub Advanced Security for Actions, ActionLint, and/or zizmor&lt;/td&gt;
&lt;td&gt;PR checks and workflow run logs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The repository uses Dependabot or Renovate — for both its action references and its underlying implementation dependencies — and is current with updates&lt;/td&gt;
&lt;td&gt;Pull requests and workflow logs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The repository configures a Renovate/Dependabot cooldown (minimum release age)&lt;/td&gt;
&lt;td&gt;Configuration file on the default branch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The action has unit and/or integration tests&lt;/td&gt;
&lt;td&gt;Repository contents and workflow runs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The repository uses StepSecurity Harden-Runner or GitHub's new egress firewall in its own workflows&lt;/td&gt;
&lt;td&gt;Workflow files in the repository&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;On that last point: check that the firewall is not running in audit mode only. Audit mode records egress without blocking it, which is a useful first step but provides no actual containment.&lt;/p&gt;

&lt;h3&gt;
  
  
  Runtime and dependency hygiene
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Signal&lt;/th&gt;
&lt;th&gt;How to verify&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Uses a currently supported Node handler (JavaScript actions)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;action.yml&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Uses an up-to-date base image (Docker actions)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;action.yml&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Does not depend on unpinned actions, npm packages or Python packages, or on versions that cannot be controlled through inputs — no bare &lt;code&gt;npx eslint&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Not always straightforward. AI-assisted review, such as Copilot code review, frequently finds these&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Does not use floating Docker image tags such as &lt;code&gt;latest&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;action.yml&lt;/code&gt; for Docker actions. Harder for actions that invoke the Docker CLI internally; AI review often catches these&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;For composite actions: references pinned, locked or immutable actions&lt;/td&gt;
&lt;td&gt;Largely verifiable with GHAS for Actions, plus manual review&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Validates remotely downloaded artefacts&lt;/td&gt;
&lt;td&gt;Sometimes detectable with AI. Otherwise manual review&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The unpinned-dependency category is the one I would prioritise. An action that pins its own action references but then runs &lt;code&gt;npx some-tool&lt;/code&gt; at execution time has simply moved the unpinned dependency one level down, where it is harder to see.&lt;/p&gt;

&lt;h3&gt;
  
  
  Release integrity
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Signal&lt;/th&gt;
&lt;th&gt;How to verify&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Versioning is implemented correctly — semantic versioning, correctly maintained floating tags&lt;/td&gt;
&lt;td&gt;Difficult to inspect. I wrote a &lt;a href="https://github.com/jessehouwing/actions-semver-checker/?ref=jessehouwing.net" rel="noopener noreferrer"&gt;GitHub Action and PowerShell library&lt;/a&gt; for it. A surprising number of actions have a questionable history where version numbers are concerned&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Uses immutable releases&lt;/td&gt;
&lt;td&gt;Release metadata. A recently introduced feature; many actions still need to adopt it&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Has release attestation, and the attestation validates&lt;/td&gt;
&lt;td&gt;Should be attached to the GitHub release, and validation should be performed against the original source&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Passes an anti-virus scan&lt;/td&gt;
&lt;td&gt;You must do this yourself — GitHub does not virus-scan action releases&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;One detail worth knowing about attestations: they are bound to the source repository and &lt;strong&gt;cannot be transferred&lt;/strong&gt;. If your organisation mirrors actions into an internal repository, the attestation does not travel with the mirror. Validation has to happen against the original source.&lt;/p&gt;

&lt;h3&gt;
  
  
  Governance
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Signal&lt;/th&gt;
&lt;th&gt;How to verify&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Has licence, security and contributing policies&lt;/td&gt;
&lt;td&gt;Policy files on the main branch&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Uses a licence your organisation accepts&lt;/td&gt;
&lt;td&gt;Licence file. In practice it is often sufficient that a licence is defined at all&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Tier 2: weaker signals
&lt;/h2&gt;

&lt;p&gt;These are worth looking at. None of them should decide the matter on its own, and each comes with a meaningful caveat.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Signal&lt;/th&gt;
&lt;th&gt;Why it is weak&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Published on the Marketplace&lt;/td&gt;
&lt;td&gt;Several widely used actions are not, including GitHub's own CodeQL actions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No dependencies with known security issues&lt;/td&gt;
&lt;td&gt;Sometimes you are simply waiting for a fix to propagate through the dependency chain. Sometimes a vulnerability does not apply to the Actions hosting model at all and can safely be ignored&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;No open security advisories for recent versions&lt;/td&gt;
&lt;td&gt;Useful, but absence of advisories is not evidence of absence of problems&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A reasonable OpenSSF Scorecard score&lt;/td&gt;
&lt;td&gt;Genuinely hard to achieve. Few organisations or individuals make the effort. I attempted it for my own actions and abandoned it — a great deal of work for very little recognition&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;More than one maintainer&lt;/td&gt;
&lt;td&gt;Wishful thinking for many niche actions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Hosted by an organisation rather than a personal account&lt;/td&gt;
&lt;td&gt;Same caveat&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The repository has required PR checks&lt;/td&gt;
&lt;td&gt;Only visible in recent pull requests and workflow logs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recent commits went through pull requests&lt;/td&gt;
&lt;td&gt;Wishful thinking for many niche actions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recently updated&lt;/td&gt;
&lt;td&gt;Often unnecessary for PowerShell or Bash actions. Considerably more important for Docker and JavaScript actions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Verified creator badge&lt;/td&gt;
&lt;td&gt;The badge adds very little and represents no additional security guarantee&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Many stars&lt;/td&gt;
&lt;td&gt;Stars can be bought in bulk, and cheaply&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Few open issues&lt;/td&gt;
&lt;td&gt;Some actions accumulate many issues precisely because the community is active — Renovate, for example. Others run aggressive stale-bot configurations to keep the count low&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Few open pull requests&lt;/td&gt;
&lt;td&gt;Same reasoning. Pull request cycle time would be a better indicator, but it is not easy to read out&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Used by organisations you trust&lt;/td&gt;
&lt;td&gt;The dependents view shows which organisations use the action directly on public GitHub. A reasonable indication of who else has extended trust&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Has a clear feedback channel (issues, community, email, support link)&lt;/td&gt;
&lt;td&gt;Indicates responsiveness rather than security&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;From a well-known organisation (AWS, Microsoft, Azure, GitHub)&lt;/td&gt;
&lt;td&gt;No guarantee. Large vendors have been caught by recent supply-chain worms such as Shai-Hulud&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The release is a signed commit&lt;/td&gt;
&lt;td&gt;Commit signing remains awkward in public open source, and its meaning is limited — anyone can sign a commit&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The repository has Copilot code review, CodeRabbit or a similar integration enabled&lt;/td&gt;
&lt;td&gt;AI offers no guarantee and is sometimes wrong, but it does often catch things that would otherwise slip past&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The recurring theme in this tier is that most of these signals measure &lt;strong&gt;popularity or project health&lt;/strong&gt; , not security. They are easy to query, which is precisely why they get over-weighted. Ease of measurement is not the same as relevance.&lt;/p&gt;




&lt;h2&gt;
  
  
  Working through it in practice
&lt;/h2&gt;

&lt;p&gt;Not every signal costs the same to check. It helps to separate them by effort:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run automated checks on the candidate action. ✅&lt;/li&gt;
&lt;li&gt;Is there a clear disqualifier? ❓

&lt;ul&gt;
&lt;li&gt;Yes: reject the action or request changes. ❌&lt;/li&gt;
&lt;li&gt;No: continue with AI-assisted review. 🤖&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Are there findings that need confirmation? ❓

&lt;ul&gt;
&lt;li&gt;Yes: perform a manual review. 🔎&lt;/li&gt;
&lt;li&gt;No: manually review high-risk areas only. ⚠️&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Make a decision. ✅&lt;/li&gt;
&lt;li&gt;Lock the resolved commit regardless of the decision. 🔒&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Automatable or queryable:&lt;/strong&gt; presence of policy files, licence type, Node handler version, &lt;code&gt;action.yml&lt;/code&gt; contents, immutable release status, marketplace presence, advisory status, maintainer count, update recency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Requires AI assistance to find reliably:&lt;/strong&gt; unpinned transitive dependencies, floating Docker tags in shell invocations, unvalidated remote downloads. These are the categories where reading every line manually is impractical and pattern matching is unreliable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Requires manual review:&lt;/strong&gt; versioning history, artefact validation logic, whether an egress firewall is actually enforcing, and the overall question of whether the action does what it claims.&lt;/p&gt;




&lt;h2&gt;
  
  
  The control that matters most
&lt;/h2&gt;

&lt;p&gt;The checklist tells you whether an action is worth trusting &lt;strong&gt;at the moment you look at it&lt;/strong&gt;. Something else has to make that assessment hold, because a floating tag can be force pushed at any time — by the maintainer, or by whoever compromises the account. The version you assessed is not necessarily the version that executes tomorrow.&lt;/p&gt;

&lt;p&gt;Three mechanisms address this, and they achieve broadly the same effect:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Mechanism&lt;/th&gt;
&lt;th&gt;Where it applies&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Commit SHA pinning&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Consumer side, per reference&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://docs.github.com/en/actions/how-tos/create-and-publish-actions/using-immutable-releases-and-tags-to-manage-your-actions-releases?ref=jessehouwing.net" rel="noopener noreferrer"&gt;Immutable releases&lt;/a&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Producer side, per release&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/github/gh-actions-lock/?ref=jessehouwing.net" rel="noopener noreferrer"&gt;Action lock files&lt;/a&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Consumer side, per repository&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;All three ensure the code you reviewed is the code that runs. My clear preference is for immutable releases and lock files over raw SHA pinning.&lt;/p&gt;

&lt;h3&gt;
  
  
  Immutable releases
&lt;/h3&gt;

&lt;p&gt;When a repository has immutable releases enabled, a release published with a release-specific tag such as &lt;code&gt;v1.0.0&lt;/code&gt; becomes unchangeable. The tag cannot be moved afterwards.&lt;/p&gt;

&lt;p&gt;Note that this applies to tags tied to a GitHub release. Floating convenience tags such as &lt;code&gt;v1&lt;/code&gt; or &lt;code&gt;v1.1&lt;/code&gt; — which maintainers deliberately move to the latest compatible patch — are not covered, and are not intended to be. That is precisely why consumers still need a locking mechanism of their own.&lt;/p&gt;

&lt;p&gt;For maintainers, this is one of the cheapest items in Tier 1 to adopt, and it improves the situation for every consumer at once.&lt;/p&gt;

&lt;h3&gt;
  
  
  Action lock files
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/github/gh-actions-lock/?ref=jessehouwing.net" rel="noopener noreferrer"&gt;&lt;code&gt;gh-actions-lock&lt;/code&gt;&lt;/a&gt; is a &lt;code&gt;gh&lt;/code&gt; CLI extension, part of GitHub's Workflow Dependency Pinning effort. It produces a lockfile at &lt;code&gt;.github/workflows/actions.lock&lt;/code&gt; that pins every workflow dependency to a verified commit.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh extension &lt;span class="nb"&gt;install &lt;/span&gt;github/gh-actions-lock
gh actions-lock &lt;span class="c"&gt;# scan workflows, pin, write the lockfile&lt;/span&gt;
gh actions-lock &lt;span class="nt"&gt;--relock&lt;/span&gt; &lt;span class="c"&gt;# re-resolve refs that have legitimately moved&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important point is that this is &lt;strong&gt;not merely SHA pinning with extra steps&lt;/strong&gt;. The lockfile carries verification that a bare SHA in a &lt;code&gt;uses:&lt;/code&gt; line cannot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Onboarded workflows enforce that every dependency is present in the lockfile, and that the locked commit is what executes on the runner.&lt;/li&gt;
&lt;li&gt;Lockfiles are verified against forgery: the SHA must exist in the refs it claims to exist in.&lt;/li&gt;
&lt;li&gt;Repository identity is recorded, and redirects or mismatches are blocked at runtime.&lt;/li&gt;
&lt;li&gt;A locked action must have a branch containing the locked commit, which makes impostor-commit attacks considerably harder.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last point deserves emphasis. A raw SHA in a workflow file offers no protection against an impostor commit — a commit pushed to a fork, which remains reachable through the upstream repository's object store and therefore resolves successfully. It looks entirely legitimate in a &lt;code&gt;uses:&lt;/code&gt; line. The lockfile's reachability check is what closes that gap.&lt;/p&gt;

&lt;p&gt;Do note that the extension is a technical preview and pre-1.0; the lockfile format and flags may change.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not raw SHA pinning
&lt;/h3&gt;

&lt;p&gt;SHA pinning works, and it is better than a floating tag. But as a practice it has real drawbacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It destroys readability.&lt;/strong&gt; &lt;code&gt;uses: some-org/some-action@a1b2c3d…&lt;/code&gt; conveys nothing. The version has to be carried in a trailing comment, which nothing validates and which drifts from reality over time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It is per-reference.&lt;/strong&gt; Every workflow file must be maintained individually, rather than governed by one lockfile.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It offers no verification.&lt;/strong&gt; As above, a SHA alone does not prove the commit belongs to the repository's history.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A lock file gives you the same guarantee with better ergonomics and meaningfully stronger verification. Immutable releases give you upstream guarantees that need no consumer-side maintenance at all.&lt;/p&gt;

&lt;p&gt;Whichever you choose, combine it with dependency automation: let Renovate or Dependabot propose updates, configured with a cooldown period, so that a compromised release has time to be discovered before it reaches your pipelines.&lt;/p&gt;




&lt;h2&gt;
  
  
  Using the list sensibly
&lt;/h2&gt;

&lt;p&gt;Very few actions will satisfy the whole of Tier 1. That is not a reason to discard the list; it is a reason to use it comparatively. When two actions solve the same problem, the checklist gives you a defensible basis for choosing one. When only one action solves the problem, it tells you which risks you are accepting, and where compensating controls are needed.&lt;/p&gt;

&lt;p&gt;It also gives maintainers a roadmap. Much of Tier 1 is achievable by a single maintainer with focused effort — policy files, dependency automation with a cooldown, locked references, immutable releases, an attestation on the release. That is a materially different security posture from where most actions currently sit, and it does not require an organisation behind it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tooling that covers part of this
&lt;/h3&gt;

&lt;p&gt;StepSecurity's &lt;a href="https://app.stepsecurity.io/github-action-advisor?ref=jessehouwing.net" rel="noopener noreferrer"&gt;GitHub Action Advisor&lt;/a&gt; implements a portion of the automatable side of this list — maintenance and release signals, dependency and pinning hygiene, policy files, advisories — and presents them as a per-action risk assessment. It also adds signals this checklist cannot easily produce on its own, such as observed runtime behaviour drawn from Harden-Runner telemetry across the organisations that use it.&lt;/p&gt;

&lt;p&gt;Organisations that have granted the StepSecurity GitHub App access to their repositories get more from it: the advisor can then evaluate the actions actually referenced across the estate, rather than only the one you happen to be looking up.&lt;/p&gt;

&lt;p&gt;It does not replace Tier 1 entirely — the AI-assisted and manual categories above remain yours to cover — but it is a reasonable way to get the queryable signals in one place instead of assembling them by hand.&lt;/p&gt;

</description>
      <category>github</category>
      <category>githubactions</category>
    </item>
    <item>
      <title>Can one agent start another? Queueing sub-tasks in GitHub Agentic Workflows</title>
      <dc:creator>Jesse Houwing</dc:creator>
      <pubDate>Fri, 04 Sep 2026 16:56:32 +0000</pubDate>
      <link>https://dev.to/jessehouwing/can-one-agent-start-another-queueing-sub-tasks-in-github-agentic-workflows-3l6b</link>
      <guid>https://dev.to/jessehouwing/can-one-agent-start-another-queueing-sub-tasks-in-github-agentic-workflows-3l6b</guid>
      <description>&lt;p&gt;Consider a "dark factory" setup: a software factory with almost no people on the production line. A small number of people orchestrate the system, but agents do most of the work: planning, coding, reviewing, securing, deploying and reporting back. The goal is to define the factory itself as code.&lt;/p&gt;

&lt;p&gt;For that to work, agents need to trigger on each other's work with minimal human interaction. One agent may create an issue, another may turn it into a plan, another may implement the code, another may review or secure it, and another may prepare the deployment. The hand-off can happen through an IDE, issues, pull requests, comments, workflow dispatches or other integration points, but the operating model assumes that most work is performed by agents.&lt;/p&gt;

&lt;p&gt;That ambition quickly runs into GitHub's accountability model. GitHub has designed Copilot coding agent and Actions interactions so that certain work cannot silently cascade from one agent to another without a human or accountable identity in the loop. The visible symptom may look like an API problem:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;POST /agents/repos/{owner}/{repo}/tasks
→ 404

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The 404 is the product of deliberate interaction boundaries around identity, billing, legal accountability and human oversight. Understanding those boundaries determines which orchestration patterns are viable today and which remain unavailable.&lt;/p&gt;




&lt;h2&gt;
  
  
  The accountability rule that explains everything
&lt;/h2&gt;

&lt;p&gt;From &lt;a href="https://docs.github.com/en/copilot/how-tos/use-copilot-agents/cloud-agent/use-cloud-agent-via-the-api?ref=jessehouwing.net" rel="noopener noreferrer"&gt;GitHub's docs on the agent tasks API&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The agent tasks API only supports &lt;strong&gt;user-to-server&lt;/strong&gt; tokens. You can authenticate using a personal access token, an OAuth app token or a GitHub App user-to-server token.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Server-to-server tokens, such as GitHub App installation access tokens, are not supported.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; your workflow receives automatically is an &lt;em&gt;installation access token&lt;/em&gt;. It is server-to-server, and there is no user behind it — which is precisely its purpose.&lt;/p&gt;

&lt;p&gt;So when a workflow attempts to start a cloud agent session with &lt;code&gt;GITHUB_TOKEN&lt;/code&gt;, GitHub is not confused about permissions. It rejects the request because &lt;strong&gt;there is no accountable party&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;That accountability matters for three concrete reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Licensing and cost.&lt;/strong&gt; A cloud agent session consumes AI Credits (AIC), and those are charged to &lt;strong&gt;the token owner&lt;/strong&gt;. With no user behind the token, there is nobody to charge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Abuse prevention.&lt;/strong&gt; If a workflow token could spawn agents, any repository with a workflow could provision unlimited agent capacity without a single Copilot licence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Responsibility.&lt;/strong&gt; When an autonomous agent produces questionable changes, there must be an identity on the audit trail.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;gh-aw states this plainly in its own source (&lt;a href="https://github.com/github/gh-aw/blob/main/pkg/workflow/github_token.go?ref=jessehouwing.net" rel="noopener noreferrer"&gt;&lt;code&gt;pkg/workflow/github_token.go&lt;/code&gt;&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Note: The default GITHUB_TOKEN is NOT included as a fallback because it does not have&lt;/span&gt;
&lt;span class="c1"&gt;// permission to create agent sessions, assign issues to bots, or add bots as reviewers.&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The distinction that matters: sub-agent vs. new agent session
&lt;/h2&gt;

&lt;p&gt;This is the misconception at the root of the problem, and it is worth stating explicitly.&lt;/p&gt;

&lt;p&gt;The two options may sound similar, but they run in different places, use different identities and carry different accountability boundaries:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Sub-agent&lt;/th&gt;
&lt;th&gt;Cloud agent session&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Where it runs&lt;/td&gt;
&lt;td&gt;Same runner, same job&lt;/td&gt;
&lt;td&gt;GitHub-hosted, separate lifecycle&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Trigger&lt;/td&gt;
&lt;td&gt;In-process, same run&lt;/td&gt;
&lt;td&gt;&lt;code&gt;POST /agents/.../tasks&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Auth&lt;/td&gt;
&lt;td&gt;Inherits the run's context&lt;/td&gt;
&lt;td&gt;Needs a &lt;strong&gt;user&lt;/strong&gt; token&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Who's accountable&lt;/td&gt;
&lt;td&gt;Whoever/whatever triggered the workflow&lt;/td&gt;
&lt;td&gt;The token owner&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cost model&lt;/td&gt;
&lt;td&gt;Part of the run's inference&lt;/td&gt;
&lt;td&gt;AI Credits charged to the token owner&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A sub-agent is comparable to a function call. A cloud agent session is comparable to delegating work to an external party.&lt;/p&gt;

&lt;p&gt;Which raises the question that resolves the whole problem: &lt;em&gt;why is a separate agent session needed at all? Why can the workflow's own sub-agent not implement the code?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It can. The agent already running in your workflow has a checked-out repository, a filesystem, and a shell. It can write the code, run the tests, and open the pull request. Spawning a second agent to perform work the first agent is already positioned to do adds indirection — and it is precisely that indirection which requires the token you do not have.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pattern 1: Do the work in-run (start here)
&lt;/h2&gt;

&lt;p&gt;This is the pattern that works today, requires no PAT for the coding path, and is most likely what you actually need.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;issues&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;types&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;labeled&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
&lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
  &lt;span class="na"&gt;issues&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
  &lt;span class="na"&gt;copilot-requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt; &lt;span class="c1"&gt;# org-billed inference, no PAT&lt;/span&gt;
&lt;span class="na"&gt;engine&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;copilot&lt;/span&gt;
&lt;span class="na"&gt;safe-outputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;create-pull-request&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;draft&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;add-comment&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;

&lt;span class="gh"&gt;# Implement the labelled issue&lt;/span&gt;

Only proceed if the triggering issue carries the label &lt;span class="sb"&gt;`agentic:code-needed`&lt;/span&gt;.
&lt;span class="p"&gt;
1.&lt;/span&gt; Read the issue body and any linked design notes.
&lt;span class="p"&gt;2.&lt;/span&gt; Implement the change directly in the working tree.
&lt;span class="p"&gt;3.&lt;/span&gt; Run the test suite. If tests fail, fix and re-run — do not open a PR with red tests.
&lt;span class="p"&gt;4.&lt;/span&gt; Open a &lt;span class="gs"&gt;**draft**&lt;/span&gt; pull request describing what you changed and why.
&lt;span class="p"&gt;5.&lt;/span&gt; Comment on the originating issue linking the PR.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The agent edits files on the runner. gh-aw's safe-output layer takes the resulting diff, creates the branch, and opens the pull request through a controlled, permission-scoped code path — the agent itself never holds a write token.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One constraint to be aware of:&lt;/strong&gt; a pull request opened with &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; produces a restricted event. From the &lt;a href="https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows?ref=jessehouwing.net" rel="noopener noreferrer"&gt;Actions events reference&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When a pull request is created or updated by a workflow using &lt;code&gt;GITHUB_TOKEN&lt;/code&gt;, &lt;code&gt;pull_request&lt;/code&gt; events [...] create workflow runs that &lt;strong&gt;require approval&lt;/strong&gt;. [...] With the exception of &lt;code&gt;workflow_dispatch&lt;/code&gt; and &lt;code&gt;repository_dispatch&lt;/code&gt;, other &lt;code&gt;GITHUB_TOKEN&lt;/code&gt;-triggered events &lt;strong&gt;do not create workflow runs at all&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So your CI may wait for manual approval. This is the same accountability principle in a different form. If you need CI to run automatically, use &lt;code&gt;repository_dispatch&lt;/code&gt;, or configure gh-aw's CI-trigger token with a PAT.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pattern 2: Two-phase with a gate
&lt;/h2&gt;

&lt;p&gt;If you genuinely want plan-then-implement as separate runs, split them across an artifact GitHub can observe — an issue, a label, a comment.&lt;/p&gt;

&lt;p&gt;One practical shape is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;A schedule, issue or other trigger starts a planner workflow.&lt;/li&gt;
&lt;li&gt;The planner workflow creates or updates an issue and applies a label such as &lt;code&gt;agentic:code-needed&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A gate is applied, either by a human or by a separate approval signal such as &lt;code&gt;agentic:approved&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The builder workflow starts on the approved label or dispatch event.&lt;/li&gt;
&lt;li&gt;The builder workflow's own agent or sub-agent implements the change and runs tests.&lt;/li&gt;
&lt;li&gt;The workflow opens a pull request using &lt;code&gt;create-pull-request&lt;/code&gt;.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# planner.md&lt;/span&gt;
&lt;span class="na"&gt;safe-outputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;create-issue&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;labels&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;agentic&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;&lt;span class="nv"&gt;code-needed&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
    &lt;span class="na"&gt;max&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;


&lt;span class="c1"&gt;# builder.md&lt;/span&gt;
&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;issues&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;types&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;labeled&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Same caveat: an issue created by &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; won't trigger the &lt;code&gt;issues.labeled&lt;/code&gt; run. Options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Have a human apply the approval label — often exactly the gate you want anyway.&lt;/li&gt;
&lt;li&gt;Use &lt;code&gt;repository_dispatch&lt;/code&gt; from the planner.&lt;/li&gt;
&lt;li&gt;Give the planner's safe output a PAT so the created issue carries a user identity.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Note that the third option reintroduces the human implicitly: the PAT owner &lt;em&gt;is&lt;/em&gt; the accountable party, having pre-authorised the work rather than approving each instance.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pattern 3: Spawning a cloud agent session (supported, with a PAT)
&lt;/h2&gt;

&lt;p&gt;If you require a genuinely independent agent session, gh-aw supports it. The requirement is an explicit user identity.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;safe-outputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;create-agent-session&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;base&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;main&lt;/span&gt;
    &lt;span class="na"&gt;max&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="c1"&gt;# default 1, maximum 10&lt;/span&gt;
    &lt;span class="na"&gt;github-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GH_AW_AGENT_TOKEN }}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or, for existing issues:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;safe-outputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;assign-to-agent&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;target&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;triggering&lt;/span&gt;
    &lt;span class="na"&gt;github-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GH_AW_AGENT_TOKEN }}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The token requirements, per gh-aw's &lt;a href="https://github.com/github/gh-aw/blob/main/docs/src/content/docs/reference/copilot-cloud-agent.mdx?ref=jessehouwing.net" rel="noopener noreferrer"&gt;Copilot Cloud Agent reference&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Fine-grained PAT&lt;/strong&gt; — repository permissions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Read: &lt;strong&gt;metadata&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Read &amp;amp; write: &lt;strong&gt;actions&lt;/strong&gt; , &lt;strong&gt;contents&lt;/strong&gt; , &lt;strong&gt;issues&lt;/strong&gt; , &lt;strong&gt;pull requests&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Classic PAT&lt;/strong&gt; — the &lt;code&gt;repo&lt;/code&gt; scope.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gh aw secrets &lt;span class="nb"&gt;set &lt;/span&gt;GH_AW_AGENT_TOKEN &lt;span class="nt"&gt;--value&lt;/span&gt; &lt;span class="s2"&gt;"&amp;lt;your-pat&amp;gt;"&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;GH_AW_AGENT_TOKEN&lt;/code&gt; is a &lt;em&gt;magic secret&lt;/em&gt; — gh-aw looks for it by name, so you don't reference it in frontmatter. The resolution chain the compiler emits is &lt;code&gt;GH_AW_AGENT_TOKEN || GH_AW_GITHUB_TOKEN || GITHUB_TOKEN&lt;/code&gt;, and that last fallback is the one that 404s.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A GitHub App is not an alternative here.&lt;/strong&gt; gh-aw's documentation is explicit: &lt;em&gt;"The Copilot assignment API requires a Personal Access Token [...] GitHub App installation tokens are rejected regardless of permissions."&lt;/em&gt; An App is server-to-server, so the same constraint applies.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This pattern works, but consider what it implies. A PAT is a &lt;strong&gt;standing delegation of a specific person's identity, Copilot entitlement, and AI Credit balance&lt;/strong&gt;. The "no human in the loop" claim becomes "one person pre-authorised everything, indefinitely, until the token expires." That is a legitimate architecture, but it should not be mistaken for having removed the human.&lt;/p&gt;




&lt;h2&gt;
  
  
  Pattern 4: Fan-out inside a single run
&lt;/h2&gt;

&lt;p&gt;For parallelism without spawning sessions, keep the work inside the run. gh-aw caps every safe output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;safe-outputs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;create-issue&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;max&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5&lt;/span&gt;
  &lt;span class="na"&gt;create-agent-session&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;max&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt; &lt;span class="c1"&gt;# each still needs the PAT&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Your workflow agent can analyse, decide, and emit up to &lt;code&gt;max&lt;/code&gt; outputs from a single run. The bound is deliberate: an agent able to spawn agents without limit is a fork bomb with a cost attached.&lt;/p&gt;




&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Supported today
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Agent writes code and opens a PR in one run&lt;/td&gt;
&lt;td&gt;✅ No PAT needed for the code path&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sub-agents / custom agents inside a run&lt;/td&gt;
&lt;td&gt;✅ Same runner, same job&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Multi-workflow chains via issues/labels/comments&lt;/td&gt;
&lt;td&gt;✅ Subject to the &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; event rule&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Spawning cloud agent sessions&lt;/td&gt;
&lt;td&gt;✅ With a user PAT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Assigning Copilot to issues/PRs&lt;/td&gt;
&lt;td&gt;✅ With a user PAT&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cross-repo agent sessions&lt;/td&gt;
&lt;td&gt;✅ Explicit &lt;code&gt;target-repo&lt;/code&gt; / &lt;code&gt;allowed-repos&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Org-billed inference, zero PATs&lt;/td&gt;
&lt;td&gt;✅ &lt;code&gt;permissions: copilot-requests: write&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Not supported
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Cloud agent session with plain &lt;code&gt;GITHUB_TOKEN&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;❌ Server-to-server rejected by design&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GitHub App installation token for agent tasks or assignment&lt;/td&gt;
&lt;td&gt;❌ Same reason&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Org billing as a substitute for user identity&lt;/td&gt;
&lt;td&gt;❌ Covers &lt;strong&gt;inference&lt;/strong&gt; , not &lt;strong&gt;spawning&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Unbounded self-replicating agents&lt;/td&gt;
&lt;td&gt;❌ &lt;code&gt;max&lt;/code&gt; caps, hard ceiling of 10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Silent workflow chain reactions on &lt;code&gt;GITHUB_TOKEN&lt;/code&gt; events&lt;/td&gt;
&lt;td&gt;❌ Only &lt;code&gt;workflow_dispatch&lt;/code&gt; / &lt;code&gt;repository_dispatch&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;target-repo: "*"&lt;/code&gt; on &lt;code&gt;create-agent-session&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;❌ Explicit repos only&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Inference vs. spawning: a distinction worth being precise about
&lt;/h2&gt;

&lt;p&gt;gh-aw does offer a genuine "no PAT required" path, and it is easily over-interpreted.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;permissions: copilot-requests: write&lt;/code&gt; lets the &lt;strong&gt;Actions token&lt;/strong&gt; pay for Copilot inference, with the AI Credits charged against your organisation's Copilot tenant rather than any individual. No &lt;code&gt;COPILOT_GITHUB_TOKEN&lt;/code&gt;, no PAT. It requires the organisation policy &lt;strong&gt;Settings → Copilot → Policies → Copilot CLI → "Allow use of Copilot CLI billed to the organization"&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is a significant convenience. It also applies &lt;strong&gt;only to inference&lt;/strong&gt; — the model calls made by the agent running inside your workflow.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;copilot-requests: write → the agent in your workflow can THINK, AIC billed to the org ✅
copilot-requests: write → the agent in your workflow can SPAWN another agent ❌

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Spawning still requires a user-to-server token, and the resulting session's AI Credits are charged to &lt;strong&gt;that token's owner&lt;/strong&gt; , not to the organisation tenant. I expect this to relax eventually in an enterprise context, where cost can roll up to an enterprise-level identity that is itself an accountable principal — but I am not aware of any preview flag for it today, and the API documentation gives no indication of one.&lt;/p&gt;




&lt;h2&gt;
  
  
  What to tell your agent
&lt;/h2&gt;

&lt;p&gt;Copilot performs poorly on this topic at present, largely for reasons outside its control. The surface changed recently (gh-aw renamed &lt;code&gt;create-agent-task&lt;/code&gt; to &lt;code&gt;create-agent-session&lt;/code&gt; in 0.4.0), there is very little public example code, and models fill the gaps with confident invention — such as recommending a support ticket for a feature flag that does not exist.&lt;/p&gt;

&lt;p&gt;Two measures help considerably:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Clone &lt;code&gt;github/gh-aw&lt;/code&gt; and add it to your workspace.&lt;/strong&gt; Then instruct the agent: &lt;em&gt;"When in doubt about how agentic workflows function, read the actual implementation instead of making assumptions."&lt;/em&gt; (This warrants a separate article — it is the most effective technique I know for fast-moving dependencies.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Put the constraint in your instructions file.&lt;/strong&gt; Something like:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- .github/copilot-instructions.md --&amp;gt;&lt;/span&gt;
&lt;span class="gu"&gt;## Agentic workflow constraints&lt;/span&gt;
&lt;span class="p"&gt;
-&lt;/span&gt; &lt;span class="sb"&gt;`GITHUB_TOKEN`&lt;/span&gt; CANNOT create Copilot cloud agent sessions. The agent tasks API
  requires a user-to-server token. Do not suggest support tickets or feature flags.
&lt;span class="p"&gt;-&lt;/span&gt; Prefer implementing code in-run with a sub-agent + &lt;span class="sb"&gt;`create-pull-request`&lt;/span&gt; over
  spawning a new agent session.
&lt;span class="p"&gt;-&lt;/span&gt; Only use &lt;span class="sb"&gt;`create-agent-session`&lt;/span&gt; / &lt;span class="sb"&gt;`assign-to-agent`&lt;/span&gt; when &lt;span class="sb"&gt;`GH_AW_AGENT_TOKEN`&lt;/span&gt;
  is configured, and say so explicitly.
&lt;span class="p"&gt;-&lt;/span&gt; Run &lt;span class="sb"&gt;`gh aw compile`&lt;/span&gt; before committing any workflow change.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The instinct to "queue a sub-task" by spawning a new agent is inherited from human organisations, where delegation is how parallelism is achieved. In an agentic workflow it is usually an anti-pattern: you already have an agent running on a runner, with the repository checked out and a shell available. Use it.&lt;/p&gt;

&lt;p&gt;Use a cloud agent session when you genuinely need what it uniquely provides — an independent lifecycle, work that outlives your run, and its own review surface. Then treat the PAT as a requirement rather than an obstacle. It is GitHub's answer to the question of who authorised the work, and that question deserves an answer.&lt;/p&gt;




&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/copilot/how-tos/use-copilot-agents/cloud-agent/use-cloud-agent-via-the-api?ref=jessehouwing.net" rel="noopener noreferrer"&gt;Using Copilot cloud agent via the API&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows?ref=jessehouwing.net" rel="noopener noreferrer"&gt;Events that trigger workflows&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/github/gh-aw/blob/main/docs/src/content/docs/reference/copilot-cloud-agent.mdx?ref=jessehouwing.net" rel="noopener noreferrer"&gt;gh-aw: Copilot Cloud Agent reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/github/gh-aw/blob/main/docs/src/content/docs/reference/safe-outputs.md?ref=jessehouwing.net" rel="noopener noreferrer"&gt;gh-aw: Safe Outputs reference&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/github/gh-aw?ref=jessehouwing.net" rel="noopener noreferrer"&gt;github/gh-aw&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>github</category>
      <category>githubcopilot</category>
    </item>
    <item>
      <title>Ground your GitHub Copilot agent in a local clone instead of letting it guess</title>
      <dc:creator>Jesse Houwing</dc:creator>
      <pubDate>Fri, 04 Sep 2026 15:34:13 +0000</pubDate>
      <link>https://dev.to/jessehouwing/ground-your-github-copilot-agent-in-a-local-clone-instead-of-letting-it-guess-1f51</link>
      <guid>https://dev.to/jessehouwing/ground-your-github-copilot-agent-in-a-local-clone-instead-of-letting-it-guess-1f51</guid>
      <description>&lt;p&gt;A long debugging session lost to GitHub Agentic Workflows. Not because the tool was broken, but because the agent kept inventing how it worked. The model was not being unreasonable. It was being asked an impossible question.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;github/gh-aw&lt;/code&gt; renamed a core safe output from &lt;code&gt;create-agent-task&lt;/code&gt; to &lt;code&gt;create-agent-session&lt;/code&gt; in version 0.4.0. There are perhaps a few dozen real-world examples of the tool in public. A significant portion of what exists online describes the previous shape. An LLM asked about a topic with thin, contradictory, recently changed training data will not say "I don't know" — it will interpolate, and it will do so fluently.&lt;/p&gt;

&lt;p&gt;The remedy is straightforward: &lt;strong&gt;stop asking it to recall, and give it something to read.&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The technique
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; ~/src
git clone https://github.com/github/gh-aw.git

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then in VS Code: &lt;strong&gt;File → Add Folder to Workspace…&lt;/strong&gt; → pick the clone.&lt;/p&gt;

&lt;p&gt;Then, in your Copilot session:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I've added the &lt;code&gt;github/gh-aw&lt;/code&gt; repo to this workspace at &lt;code&gt;~/src/gh-aw&lt;/code&gt;. That's the actual implementation and documentation for GitHub Agentic Workflows. When you're unsure how something works, read the source there instead of assuming.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That is the entire technique. The agent now has grep access to ground truth.&lt;/p&gt;

&lt;p&gt;I use this regularly — for debugging VS Code extensions, for comparing a framework's actual behaviour against its documented behaviour, and for any dependency that moves faster than model training cycles. It consumes a considerable number of tokens, and it is highly effective.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why this is preferable to the alternatives
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Source&lt;/th&gt;
&lt;th&gt;Strength&lt;/th&gt;
&lt;th&gt;Limitation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Model memory&lt;/td&gt;
&lt;td&gt;Fast and free&lt;/td&gt;
&lt;td&gt;Often stale on fast-moving projects, and can be confidently wrong&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generic web search&lt;/td&gt;
&lt;td&gt;Reasonably current&lt;/td&gt;
&lt;td&gt;Finds blog posts, old documentation and partial examples; usually not the actual implementation&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GitHub MCP code search&lt;/td&gt;
&lt;td&gt;Searches the source repository directly, so it is much better grounded than generic web search&lt;/td&gt;
&lt;td&gt;Slower than local grep and may consume more tokens&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Local clone&lt;/td&gt;
&lt;td&gt;Exact code you depend on; greppable, cite-able and testable&lt;/td&gt;
&lt;td&gt;Requires setup and can be token-intensive if the agent reads broadly&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Documentation describes intent. Source code describes behaviour. When the two disagree — and in a fast-moving repository they will — you want your agent reading the artefact that actually runs. GitHub MCP code search is a useful alternative when you do not have a local clone: it searches the repository directly, so it is better grounded than generic web search, but it is slower than local grep and may consume more tokens.&lt;/p&gt;




&lt;h2&gt;
  
  
  A worked example
&lt;/h2&gt;

&lt;p&gt;While researching the agent-session problem, I compared gh-aw's documentation against its code. Two discrepancies emerged immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Discrepancy one — cross-repository support.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The safe-outputs specification says:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Type: create_agent_session&lt;/strong&gt; — Cross-Repository Support: &lt;strong&gt;No&lt;/strong&gt; (same repository only)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The reference doc, and the actual Go source, say otherwise:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// pkg/workflow/create_agent_session.go&lt;/span&gt;
&lt;span class="k"&gt;type&lt;/span&gt; &lt;span class="n"&gt;CreateAgentSessionConfig&lt;/span&gt; &lt;span class="k"&gt;struct&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;BaseSafeOutputConfig&lt;/span&gt; &lt;span class="s"&gt;`yaml:",inline"`&lt;/span&gt;
    &lt;span class="n"&gt;Base&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="s"&gt;`yaml:"base,omitempty"`&lt;/span&gt;
    &lt;span class="n"&gt;TargetRepoSlug&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="s"&gt;`yaml:"target-repo,omitempty"`&lt;/span&gt; &lt;span class="c"&gt;// ← cross-repo&lt;/span&gt;
    &lt;span class="n"&gt;AllowedRepos&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="s"&gt;`yaml:"allowed-repos,omitempty"`&lt;/span&gt; &lt;span class="c"&gt;// ← cross-repo&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An agent relying on the specification document would have reported that cross-repository use was impossible. The struct definition settles the question immediately.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Discrepancy two — the API version header.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;GitHub's public docs show:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="err"&gt;-H "X-GitHub-Api-Version: 2022-11-28"

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;gh-aw's implementation sends:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// actions/setup/js/create_agent_session.cjs&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;githubClient&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;request&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;POST /agents/repos/{owner}/{repo}/tasks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;owner&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;repoParts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;owner&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;repo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;repoParts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;repo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;taskDescription&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;base_ref&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;baseBranch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;X-GitHub-Api-Version&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2026-03-10&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you were debugging a raw &lt;code&gt;curl&lt;/code&gt; request against a preview API, that difference is decisive — and no amount of careful prompting would have surfaced it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The discrepancy that mattered most.&lt;/strong&gt; The token resolution chain is not documented in prose anywhere, but the source comment sets it out in full:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/**
 * Token precedence:
 * 1. config["github-token"] — per-handler PAT configured in the workflow frontmatter
 * 2. GH_AW_AGENT_SESSION_TOKEN — agent token injected by the compiler
 * (evaluates to: GH_AW_AGENT_TOKEN || GH_AW_GITHUB_TOKEN || GITHUB_TOKEN)
 * 3. global github — step-level token (fallback)
 */

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the answer: the silent fallback to &lt;code&gt;GITHUB_TOKEN&lt;/code&gt;, and the precise reason a correctly written workflow returns 404 with no useful error message. A targeted grep resolved what a long prompting session could not.&lt;/p&gt;




&lt;h2&gt;
  
  
  Bake it into your instructions
&lt;/h2&gt;

&lt;p&gt;The clone only helps if the agent actually reaches for it. Make that automatic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!-- .github/copilot-instructions.md --&amp;gt;&lt;/span&gt;

&lt;span class="gu"&gt;## Grounding sources&lt;/span&gt;

The &lt;span class="sb"&gt;`github/gh-aw`&lt;/span&gt; repository is available in this workspace at &lt;span class="sb"&gt;`../gh-aw`&lt;/span&gt;.
It contains the implementation and documentation for GitHub Agentic Workflows.
&lt;span class="p"&gt;
-&lt;/span&gt; When you hit a snag, or are unsure how agentic workflows behave, &lt;span class="ge"&gt;**&lt;/span&gt;read the
  implementation&lt;span class="ge"&gt;**&lt;/span&gt; rather than making assumptions.
&lt;span class="p"&gt;-&lt;/span&gt; Prefer, in order: &lt;span class="sb"&gt;`pkg/workflow/**`&lt;/span&gt; (Go compiler) →
  &lt;span class="sb"&gt;`actions/setup/js/**`&lt;/span&gt; (runtime handlers) → &lt;span class="sb"&gt;`docs/src/content/docs/**`&lt;/span&gt; →
  &lt;span class="sb"&gt;`CHANGELOG.md`&lt;/span&gt;.
&lt;span class="p"&gt;-&lt;/span&gt; When docs and code disagree, &lt;span class="gs"&gt;**the code wins**&lt;/span&gt; — and say so in your answer.
&lt;span class="p"&gt;-&lt;/span&gt; Cite file paths and line numbers for any claim about behaviour.
&lt;span class="p"&gt;-&lt;/span&gt; Always run &lt;span class="sb"&gt;`gh aw compile`&lt;/span&gt; before committing workflow changes.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The citation requirement is more valuable than it first appears. It serves two purposes: it gives you a quick way to verify a claim, and it makes fabrication considerably harder for the model. An answer citing &lt;code&gt;pkg/workflow/create_agent_session.go:12&lt;/code&gt; is much easier to check. An answer without a citation cannot be checked directly.&lt;/p&gt;




&lt;h2&gt;
  
  
  The complementary half: GitHub MCP for what a clone cannot provide
&lt;/h2&gt;

&lt;p&gt;A clone gives you code. It does not give you discussion. Issues, pull requests, discussions, and release notes — the layer that tells you whether something is a known problem — live on GitHub.&lt;/p&gt;

&lt;p&gt;Enable the GitHub MCP server and your agent can query that too:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;em&gt;"Search gh-aw issues for &lt;code&gt;create-agent-session&lt;/code&gt; 404"&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;"What changed in gh-aw between the version I have and main?"&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;"Are there open PRs touching the agent session token chain?"&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is where the undocumented reality surfaces: a maintainer explaining in an issue comment why something behaves as it does, a pull request that changed semantics recently, or a discussion thread describing the workaround most people use.&lt;/p&gt;

&lt;h3&gt;
  
  
  Choosing between a clone and MCP
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Question&lt;/th&gt;
&lt;th&gt;Preferred source&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;"How does X actually work?"&lt;/td&gt;
&lt;td&gt;Clone — read the source. If unavailable, GitHub MCP code search&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"What are the valid config fields?"&lt;/td&gt;
&lt;td&gt;Clone — read the struct/schema. If unavailable, GitHub MCP code search&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Why does this fail?"&lt;/td&gt;
&lt;td&gt;Clone first, then MCP for known issues&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Is this a known bug?"&lt;/td&gt;
&lt;td&gt;MCP — search issues&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"What changed recently?"&lt;/td&gt;
&lt;td&gt;Clone &lt;code&gt;CHANGELOG.md&lt;/code&gt; + &lt;code&gt;git log&lt;/code&gt;, then MCP for PRs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"How do others use this?"&lt;/td&gt;
&lt;td&gt;MCP — code search across GitHub&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Is a fix coming?"&lt;/td&gt;
&lt;td&gt;MCP — open PRs and milestones&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can skip the clone and point custom instructions at the repository URL, letting the agent search the repository through GitHub MCP. This is still much better grounded than generic web search, because the agent is searching the actual source repository. It is slower than a local clone, requires more remote calls, and may consume more tokens. I clone by default and use MCP for the discussion layer and for repository code search when cloning is not practical.&lt;/p&gt;




&lt;h2&gt;
  
  
  Practical notes
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Match the version you actually run.&lt;/strong&gt; A clone of &lt;code&gt;main&lt;/code&gt; describes the future. If you're on a release, check out the matching tag:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git &lt;span class="nt"&gt;-C&lt;/span&gt; ~/src/gh-aw fetch &lt;span class="nt"&gt;--tags&lt;/span&gt;
git &lt;span class="nt"&gt;-C&lt;/span&gt; ~/src/gh-aw checkout v0.4.0

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Otherwise you risk implementing a feature that is not yet present in your version, which is a particularly frustrating class of bug.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Refresh it deliberately.&lt;/strong&gt; Run &lt;code&gt;git pull&lt;/code&gt; before a debugging session, and note the SHA you grounded against so that it remains clear later what "the code says" referred to.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scope the search.&lt;/strong&gt; Left unbounded, an agent will search across a repository of ten thousand files. Direct it:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Look only in &lt;code&gt;pkg/workflow/&lt;/code&gt; and &lt;code&gt;actions/setup/js/&lt;/code&gt; for how the token is resolved.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;Budget for the cost.&lt;/strong&gt; This is not inexpensive; you are paying tokens to read someone else's codebase. It remains considerably cheaper than a long debugging session based on an invented diagnosis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Treat fetched content as untrusted input.&lt;/strong&gt; Issue bodies, pull request descriptions, and README files can be influenced by third parties in public repositories. If your agent reads content that begins issuing it instructions, that is prompt injection rather than documentation. Worth being aware of even if you never encounter it.&lt;/p&gt;




&lt;h2&gt;
  
  
  When it's worth it
&lt;/h2&gt;

&lt;p&gt;Grounding is worthwhile when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The dependency changed recently&lt;/li&gt;
&lt;li&gt;Public examples are scarce&lt;/li&gt;
&lt;li&gt;Behaviour is subtle — auth chains, token precedence, compilation order&lt;/li&gt;
&lt;li&gt;Docs and reality have visibly diverged&lt;/li&gt;
&lt;li&gt;You're debugging something that "should work"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Skip it for stable, well-documented libraries with many public examples. There is no need to clone React to establish what &lt;code&gt;useEffect&lt;/code&gt; does.&lt;/p&gt;

&lt;p&gt;The heuristic I apply: &lt;strong&gt;if the model sounds confident but the result does not work, it is guessing.&lt;/strong&gt; That is the point at which to clone.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;A great deal of effort goes into prompt engineering — better phrasing, better structure, better framing. That effort is worthwhile, but a larger improvement is available before any of it: give the model the actual source of truth and instruct it to read.&lt;/p&gt;

&lt;p&gt;Most agent failures I investigate are not reasoning failures. They are retrieval failures. The model reasoned correctly over information that was wrong.&lt;/p&gt;

&lt;p&gt;You would not ask a new team member to implement against a library from memory. You would point them at the repository. Apply the same approach to your agent.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git clone &amp;lt;the-thing-you-depend-on&amp;gt;
&lt;span class="c"&gt;# File → Add Folder to Workspace&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then instruct it to read.&lt;/p&gt;




&lt;h3&gt;
  
  
  Quick-start checklist
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;✅ Clone the dependency repo locally&lt;/li&gt;
&lt;li&gt;✅ Check out the tag matching your installed version&lt;/li&gt;
&lt;li&gt;✅ Add it to your VS Code workspace&lt;/li&gt;
&lt;li&gt;✅ Add a "grounding sources" section to &lt;code&gt;.github/copilot-instructions.md&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;✅ Include "when in doubt, read the implementation" as an explicit instruction&lt;/li&gt;
&lt;li&gt;✅ Require file:line citations in answers&lt;/li&gt;
&lt;li&gt;✅ Enable the GitHub MCP server for issues, PRs, and discussions&lt;/li&gt;
&lt;li&gt;✅ Refresh the clone before serious debugging sessions&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>github</category>
      <category>githubcopilot</category>
      <category>visualstudiocode</category>
    </item>
    <item>
      <title>Configure Azure Pipelines app in ghe.com</title>
      <dc:creator>Jesse Houwing</dc:creator>
      <pubDate>Fri, 19 Jun 2026 13:50:47 +0000</pubDate>
      <link>https://dev.to/jessehouwing/configure-azure-pipelines-app-in-ghecom-43lp</link>
      <guid>https://dev.to/jessehouwing/configure-azure-pipelines-app-in-ghecom-43lp</guid>
      <description>&lt;p&gt;I recently helped a client migrate from Azure DevOps to GitHub Enterprise Managed Users with Data Residency (ghe.com for short). And as part of the migration we rewired the exiting Azure Pipelines from the old repository located on Azure Repos to the new one on GitHub.&lt;/p&gt;

&lt;p&gt;With GitHub Enterprise this is quite easy, create a new service connection in Azure DevOps and click the magic authorize button to install the app into GitHub automatically. Unfortunately no such luck in ghe.com, even though there is a special service connection type:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8xbt3eymxbqwtjuiuy3f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8xbt3eymxbqwtjuiuy3f.png" alt="Configure Azure Pipelines app in ghe.com" width="613" height="370"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Select the GitHub Enterprise Cloud with data residency service connection type to link Azure Pipelines with ghe.com&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The screen mentions: "GitHub Organization should have azure pipelines app already installed", but there is no documentation anywhere on how to actually do that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftlyaazldhtvgj98lx9bk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftlyaazldhtvgj98lx9bk.png" alt="Configure Azure Pipelines app in ghe.com" width="613" height="427"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Unfortunately, this already expects the Azure Pipelines app to be installed in the target GitHub organization&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And unfortunately, it turned out &lt;a href="https://developercommunity.azure.com/t/11051246?ref=jessehouwing.net" rel="noopener noreferrer"&gt;we weren't the first to hit this snag&lt;/a&gt;. And the error message is not very helpful either:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foj8wwihsrqv8zthajbnd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foj8wwihsrqv8zthajbnd.png" alt="Configure Azure Pipelines app in ghe.com" width="582" height="462"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The error message you receive is "Could not complete OAuth Authorization; verify you have enough permissions to perform this operation"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I reached out to my contacts in GitHub and Azure DevOps to see if they knew what to do, but unfortunately, even they did not know.&lt;/p&gt;

&lt;p&gt;I decided to play around some more and stumbled upon this well hidden url based on the url of the Azure Boards app by replacing &lt;code&gt;boards&lt;/code&gt; with &lt;code&gt;pipeline&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://{enterprise-slug}.ghe.com/apps/external-app/azure-boards
https://{enterprise-slug}.ghe.com/apps/external-app/azure-pipelines
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And lo and behold, from this location you can install the Azure Pipelines app:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F78fq428koj6yv9fs7axb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F78fq428koj6yv9fs7axb.png" alt="Configure Azure Pipelines app in ghe.com" width="800" height="437"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;By navigating directly to the hidden Azure Pipelines GitHub App installation page you can install the app&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;Install&lt;/strong&gt; to and select your GitHub organization, after which the configuration of the service connection will work without a hitch:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc5opbzu7sdp5h3glqo5g.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fc5opbzu7sdp5h3glqo5g.png" alt="Configure Azure Pipelines app in ghe.com" width="800" height="335"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Select the GitHub Organization you want to link to your Azure DevOps Project.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Select the repos you want to enable for Azure Pipelines:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3wz1oxuc2q1wlqsl260y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3wz1oxuc2q1wlqsl260y.png" alt="Configure Azure Pipelines app in ghe.com" width="800" height="696"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Select which repos in GitHub should be available to Azure Pipelines&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;After which you are redirected to Azure DevOps to complete the installation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff52me9286q3dglcgqscm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ff52me9286q3dglcgqscm.png" alt="Configure Azure Pipelines app in ghe.com" width="800" height="492"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Select the correct Azure DevOps organization and project&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;If you now go back into the settings of your Azure DevOps Project, you should be able to create the new service connection:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmq511c8fqoveez4pvt67.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmq511c8fqoveez4pvt67.png" alt="Configure Azure Pipelines app in ghe.com" width="800" height="354"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Create the new service connection, which should work without any issues.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Click &lt;strong&gt;Authorize&lt;/strong&gt; after which you'll be able to &lt;strong&gt;Save&lt;/strong&gt; the new service connection.&lt;/p&gt;

&lt;p&gt;To rewire a pipeline, navigate to the pipeline you want to rewire and click &lt;strong&gt;Edit&lt;/strong&gt; :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4tyigwi6k4d84vuq222e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4tyigwi6k4d84vuq222e.png" alt="Configure Azure Pipelines app in ghe.com" width="800" height="277"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Edit your existing Azure Pipelines Definitions to rewire them to GitHub&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Click the &lt;strong&gt;⁞&lt;/strong&gt; button and then select &lt;strong&gt;Triggers:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4he45e8c1wvdn7zmenhm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4he45e8c1wvdn7zmenhm.png" alt="Configure Azure Pipelines app in ghe.com" width="800" height="281"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Use the triggers editor to navigate to the classic Pipelines editor&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This brings you to the classic pipelines editor on which you can navigate to the &lt;strong&gt;YAML&lt;/strong&gt; tab:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flpepglh9fffvh8s9p4w2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flpepglh9fffvh8s9p4w2.png" alt="Configure Azure Pipelines app in ghe.com" width="799" height="297"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;In the classic Pipelines editor, navigate to the YAML tab to change the source location&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Select the &lt;strong&gt;Get Souces&lt;/strong&gt; element in the pipeline&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F55qgtt289vw6fz9ummi2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F55qgtt289vw6fz9ummi2.png" alt="Configure Azure Pipelines app in ghe.com" width="799" height="298"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Select the Get Sources step to rewire the pipeline to GitHub&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And rewire the pipeline to &lt;strong&gt;GitHub&lt;/strong&gt; by selecting the GitHub tile and picking the Service Connection we previously created:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy24obgye1ab1csiihs4t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fy24obgye1ab1csiihs4t.png" alt="Configure Azure Pipelines app in ghe.com" width="799" height="337"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;After selecting GitHub, change the service connection, repository and default branch&lt;/em&gt;&lt;/p&gt;

</description>
      <category>github</category>
      <category>azurepipelines</category>
      <category>azuredevops</category>
      <category>continuousdelivery</category>
    </item>
    <item>
      <title>Auto-assign GitHub Copilot AI Credit budget to users</title>
      <dc:creator>Jesse Houwing</dc:creator>
      <pubDate>Fri, 29 May 2026 13:26:23 +0000</pubDate>
      <link>https://dev.to/jessehouwing/auto-assign-github-copilot-ai-credit-budget-to-users-5fc1</link>
      <guid>https://dev.to/jessehouwing/auto-assign-github-copilot-ai-credit-budget-to-users-5fc1</guid>
      <description>&lt;p&gt;The deadline for GitHub Copilot Usage Based Billing is approaching rapidly. And today I've been busy setting up automation to assign each user their own bucket of Copilot AIC budget.&lt;/p&gt;

&lt;p&gt;On June 1st, all organizations should get access to the User Based Budgets and Universal User Budgets features in GitHub, allowing you to setup a a single &lt;em&gt;universal&lt;/em&gt; budget for all your users as well as individual overrides which can either be higher or lower.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setting up universal budget
&lt;/h2&gt;

&lt;p&gt;To setup a universal budget, go to the enterprise's &lt;strong&gt;Billing &amp;amp; Licensing&lt;/strong&gt; panel, select &lt;strong&gt;Budgets and Alerts&lt;/strong&gt; in the left menu an create a new budget of type "Bundled AI Credits budget":&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; the UI shows "premium request" until June 1st. Budgets should automatically transfer to "AI Credits".&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwlgozkhexqqldagxpbiz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwlgozkhexqqldagxpbiz.png" alt="Auto-assign GitHub Copilot AI Credit budget to users" width="627" height="346"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Select the Bundled Premium Requests (before June 1st)/AI Credits budget (after June 1st)&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Then set a user level budget, but &lt;em&gt;do not select any specific user&lt;/em&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff84loo0kshf7lk5rqe10.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff84loo0kshf7lk5rqe10.png" alt="Auto-assign GitHub Copilot AI Credit budget to users" width="640" height="661"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Select the User budget scope, but do not select a user&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Finally select the default budget for all user without an individual budget override:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9dac750b3matfrd68eo2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9dac750b3matfrd68eo2.png" alt="Auto-assign GitHub Copilot AI Credit budget to users" width="626" height="497"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Set the Budget amount for all users without an individual budget&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Setting an individual user budget
&lt;/h2&gt;

&lt;p&gt;Setting an individual user budget follows the same flow, but in step 2 you need to select a specific user to which the budget applies:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F89vrensnlcvrp5uvsid0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F89vrensnlcvrp5uvsid0.png" alt="Auto-assign GitHub Copilot AI Credit budget to users" width="625" height="632"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;To set an individual user's budget, select a specific user in step 2&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Unfortunately you can't select a team or multiple users in this step, so each user needs their own individual budget. As you can imagine, this is a lot of work if you want to have specific control over different sets of users.&lt;/p&gt;
&lt;h2&gt;
  
  
  Automating the problem away
&lt;/h2&gt;

&lt;p&gt;Of course my employer is one of those places that wants control over specific groups of users. And because I'm a lazy administrator by nature, I'd like to be able to leverage our existing approval infrastructure as much as possible. Most approvals in our organization are handled by EntraID group memberships and there are existing approval workflows in Entra to allow people to request and approve access to specific groups.&lt;/p&gt;

&lt;p&gt;GitHub, unfortunately, doesn't allow linking a user budget to a group or a team, so there needs to be a mapping from group membership to budgets somewhere. And I ended up putting that in a GitHub Actions workflow of course.&lt;/p&gt;

&lt;p&gt;The workflows is quite simple:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It pulls all copilot users from the assigned seats API.&lt;/li&gt;
&lt;li&gt;It pulls all users from EntraID&lt;/li&gt;
&lt;li&gt;It pulls all group memberships for the copilot users from EntraId&lt;/li&gt;
&lt;li&gt;It pulls all user level budgets from GitHub&lt;/li&gt;
&lt;li&gt;It compares the membership to the budget setup and either creates, updates or deletes the budget in GitHub.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And it sets the universal budget based on a preconfigured value.&lt;/p&gt;

&lt;p&gt;All of this runs in a single GitHub Actions workflow an executes a single PowerShell script.&lt;/p&gt;

&lt;p&gt;I won't share the full script here in the blog post, but I will share a few of the basic building blocks so you can implement your own logic based on your own criteria:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Get existing Copilot budgets from the GitHub enterprise billing API.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="kr"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Get-ExistingBudgets&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$ProductSku&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="nv"&gt;$allBudgets&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;@()&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nv"&gt;$page&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;do&lt;/span&gt;&lt;span class="w"&gt; 
        &lt;/span&gt;&lt;span class="c"&gt;# Does not follow standard github paging, so need to manually page through the results&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;gh&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"/enterprises/&lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt;&lt;span class="s2"&gt;/settings/billing/budgets?page=&lt;/span&gt;&lt;span class="nv"&gt;$page&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ConvertFrom-Json&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nv"&gt;$allBudgets&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;+=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;budgets&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nv"&gt;$page&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kr"&gt;while&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has_next_page&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="kr"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$allBudgets&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# Create a new individual per-user budget.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="kr"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;New-IndividualBudget&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$GitHubLogin&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;decimal&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$Amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$ProductSku&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="nv"&gt;$body&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;@{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nx"&gt;budget_amount&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$Amount&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nx"&gt;budget_scope&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"user"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$GitHubLogin&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nx"&gt;budget_type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"BundlePricing"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nx"&gt;budget_product_sku&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$ProductSku&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nx"&gt;prevent_further_usage&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;$true&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nx"&gt;budget_alerting&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;@{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nx"&gt;will_alert&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;$false&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nx"&gt;alert_recipients&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;@()&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="n"&gt;Write-Output&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Creating individual budget of &lt;/span&gt;&lt;span class="se"&gt;`$&lt;/span&gt;&lt;span class="nv"&gt;$Amount&lt;/span&gt;&lt;span class="s2"&gt; for user &lt;/span&gt;&lt;span class="nv"&gt;$GitHubLogin&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="bp"&gt;$_&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$body&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ConvertTo-Json&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Depth&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;gh&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--method&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;POST&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;/enterprises/&lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt;&lt;span class="nx"&gt;/settings/billing/budgets&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--input&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# Update an existing budget amount.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="kr"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Update-Budget&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$BudgetId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;decimal&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$Amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$ProductSku&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="nv"&gt;$body&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;@{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nx"&gt;budget_amount&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$Amount&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nx"&gt;budget_product_sku&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$ProductSku&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nx"&gt;prevent_further_usage&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;$true&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="n"&gt;Write-Output&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Updating budget &lt;/span&gt;&lt;span class="nv"&gt;$BudgetId&lt;/span&gt;&lt;span class="s2"&gt; to &lt;/span&gt;&lt;span class="se"&gt;`$&lt;/span&gt;&lt;span class="nv"&gt;$Amount&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="bp"&gt;$_&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$body&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ConvertTo-Json&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Depth&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;gh&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--method&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;PATCH&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;/enterprises/&lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt;&lt;span class="nx"&gt;/settings/billing/budgets/&lt;/span&gt;&lt;span class="nv"&gt;$BudgetId&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--input&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# Delete a budget.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="kr"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Remove-Budget&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$BudgetId&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="n"&gt;Write-Output&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Deleting budget &lt;/span&gt;&lt;span class="nv"&gt;$BudgetId&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="bp"&gt;$_&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;gh&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--method&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;DELETE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;/enterprises/&lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt;&lt;span class="nx"&gt;/settings/billing/budgets/&lt;/span&gt;&lt;span class="nv"&gt;$BudgetId&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# Ensure the universal budget exists and has the correct amount.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="kr"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Update-UniversalBudget&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$ProductSku&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;decimal&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$TargetAmount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nv"&gt;$ExistingBudgets&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="nv"&gt;$universalBudget&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$ExistingBudgets&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;Where-Object&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;$_&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;budget_scope&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-eq&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"multi_user_customer"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-and&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;$_&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;budget_product_sku&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-eq&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$ProductSku&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="kr"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$universalBudget&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="kr"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$universalBudget&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;budget_amount&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-ne&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$TargetAmount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="n"&gt;Write-Output&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Updating universal budget from &lt;/span&gt;&lt;span class="se"&gt;`$&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;$universalBudget&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;budget_amount&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt; to &lt;/span&gt;&lt;span class="se"&gt;`$&lt;/span&gt;&lt;span class="nv"&gt;$TargetAmount&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="n"&gt;Update-Budget&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Enterprise&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-BudgetId&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$universalBudget&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Amount&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$TargetAmount&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-ProductSku&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$ProductSku&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="kr"&gt;else&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="n"&gt;Write-Output&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Universal budget already set to &lt;/span&gt;&lt;span class="se"&gt;`$&lt;/span&gt;&lt;span class="nv"&gt;$TargetAmount&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;else&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="n"&gt;Write-Output&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Creating universal budget of &lt;/span&gt;&lt;span class="se"&gt;`$&lt;/span&gt;&lt;span class="nv"&gt;$TargetAmount&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="nv"&gt;$body&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;@{&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nx"&gt;budget_amount&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$TargetAmount&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nx"&gt;budget_scope&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"multi_user_customer"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nx"&gt;budget_type&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"BundlePricing"&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nx"&gt;budget_product_sku&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$ProductSku&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nx"&gt;prevent_further_usage&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;$true&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="nx"&gt;budget_alerting&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;@{&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nx"&gt;will_alert&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="bp"&gt;$false&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="nx"&gt;alert_recipients&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;@()&lt;/span&gt;&lt;span class="w"&gt;
            &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="bp"&gt;$_&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$body&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;ConvertTo-Json&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;-Depth&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;gh&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;api&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--method&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;POST&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;/enterprises/&lt;/span&gt;&lt;span class="nv"&gt;$Enterprise&lt;/span&gt;&lt;span class="nx"&gt;/settings/billing/budgets&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nt"&gt;--input&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because of the change from per-user premium request budget to AI credits and the additionally included credits during the promotional period from June 1st to August 31st I've added a few helpers:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight powershell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Determine the correct budget_product_sku based on the current date.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="c"&gt;# Before June 1 2026: premium_requests&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="c"&gt;# From June 1 2026 onwards: ai_credits&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="kr"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Get-BudgetProductSku&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$AsOf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;UtcNow&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nv"&gt;$cutoverDate&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;System.DateTimeKind&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;Utc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$AsOf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-lt&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$cutoverDate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="kr"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"premium_requests"&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"ai_credits"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="c"&gt;# Determine the universal budget amount based on the current date.&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="c"&gt;# Until May 31 2026: $0 (no included credits)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="c"&gt;# June 1 - August 31 2026: $70&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="c"&gt;# September 1 2026 onwards: $39&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="kr"&gt;function&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;Get-UniversalBudgetAmount&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;param&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="nv"&gt;$AsOf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;UtcNow&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nv"&gt;$june1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;System.DateTimeKind&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;Utc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nv"&gt;$sept1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2026&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;System.DateTimeKind&lt;/span&gt;&lt;span class="p"&gt;]::&lt;/span&gt;&lt;span class="n"&gt;Utc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;

    &lt;/span&gt;&lt;span class="kr"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$AsOf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-lt&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$june1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="kr"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;decimal&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="mf"&gt;0.00&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;elseif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;$AsOf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-lt&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$sept1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="kr"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;decimal&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="mf"&gt;70.00&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="kr"&gt;else&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="kr"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;decimal&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="mf"&gt;39.00&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add your own logic to link a budget to a specific user, then call this from a simple workflow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Assign Copilot Budgets&lt;/span&gt;

&lt;span class="na"&gt;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;workflow_dispatch&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;schedule&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;cron&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;15&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;4&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*&lt;/span&gt;&lt;span class="nv"&gt; &lt;/span&gt;&lt;span class="s"&gt;*"&lt;/span&gt;

&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;update&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; 
      &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;read&lt;/span&gt;
      &lt;span class="na"&gt;id-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;

    &lt;span class="na"&gt;runs-on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-latest&lt;/span&gt;

    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;      
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd&lt;/span&gt; &lt;span class="c1"&gt;# v4&lt;/span&gt;
      &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;fetch-depth&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;

    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Azure CLI Login&lt;/span&gt;
      &lt;span class="na"&gt;uses&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43&lt;/span&gt; &lt;span class="c1"&gt;#v3.0.0&lt;/span&gt;
      &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;client-id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.AZURE_CLIENT_ID }}&lt;/span&gt;
        &lt;span class="na"&gt;tenant-id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.AZURE_TENANT_ID }}&lt;/span&gt;
        &lt;span class="na"&gt;allow-no-subscriptions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;

    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Assign Copilot Budgets&lt;/span&gt;
      &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;|&lt;/span&gt;
         &lt;span class="s"&gt;.\assign-copilot-budget.ps1&lt;/span&gt;
      &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;GH_TOKEN&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GH_TOKEN }}&lt;/span&gt;
      &lt;span class="na"&gt;shell&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;pwsh&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'll need to use a Classic PAT token with at least the following scopes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;manage_billing:enterprise
manage_billing:copilot
read:enterprise
read:user
user:email
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>github</category>
      <category>ai</category>
      <category>githubcopilot</category>
    </item>
  </channel>
</rss>
