<?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: Anthany Wingo</title>
    <description>The latest articles on DEV Community by Anthany Wingo (@anthany_wingo_195f7057a9e).</description>
    <link>https://dev.to/anthany_wingo_195f7057a9e</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%2F4183359%2F0c633bcb-9b12-46fe-b1f9-6ad8a3aa2a80.png</url>
      <title>DEV Community: Anthany Wingo</title>
      <link>https://dev.to/anthany_wingo_195f7057a9e</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anthany_wingo_195f7057a9e"/>
    <language>en</language>
    <item>
      <title>The GitHub Actions CI workflow I copy into every Node project</title>
      <dc:creator>Anthany Wingo</dc:creator>
      <pubDate>Wed, 14 Oct 2026 01:41:32 +0000</pubDate>
      <link>https://dev.to/anthany_wingo_195f7057a9e/the-github-actions-ci-workflow-i-copy-into-every-node-project-4f98</link>
      <guid>https://dev.to/anthany_wingo_195f7057a9e/the-github-actions-ci-workflow-i-copy-into-every-node-project-4f98</guid>
      <description>&lt;p&gt;Every new repo needs CI, and I kept rewriting the same YAML from memory and forgetting something each time. So here's the version I now copy everywhere, with notes on why each setting is there.&lt;/p&gt;

&lt;h2&gt;
  
  
  The workflow
&lt;/h2&gt;

&lt;p&gt;Save as &lt;code&gt;.github/workflows/ci.yml&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;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;CI (Node.js)&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;push&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;branches&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;main&lt;/span&gt;&lt;span class="pi"&gt;]&lt;/span&gt;
  &lt;span class="na"&gt;pull_request&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
&lt;span class="na"&gt;concurrency&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ github.workflow }}-${{ github.ref }}&lt;/span&gt;
  &lt;span class="na"&gt;cancel-in-progress&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;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;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="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@v4&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/setup-node@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;node-version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;20&lt;/span&gt;
          &lt;span class="na"&gt;cache&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm ci&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm run lint --if-present&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm test --if-present&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;npm run build --if-present&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Four settings most templates skip
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Cancel superseded runs
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;concurrency&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ github.workflow }}-${{ github.ref }}&lt;/span&gt;
  &lt;span class="na"&gt;cancel-in-progress&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;Push three fixes to a PR in a row and only the latest run finishes. Fewer wasted minutes and a faster signal. (For deploy workflows, set &lt;code&gt;cancel-in-progress: false&lt;/code&gt; so a deploy is never cut off halfway.)&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Least-privilege token
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CI only needs to read your code. Saying so explicitly limits what a compromised dependency or action could do with &lt;code&gt;GITHUB_TOKEN&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Built-in dependency caching
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;cache: npm&lt;/code&gt; on &lt;code&gt;actions/setup-node&lt;/code&gt; caches downloads keyed on &lt;code&gt;package-lock.json&lt;/code&gt;, with no extra &lt;code&gt;actions/cache&lt;/code&gt; step. Pair it with &lt;code&gt;npm ci&lt;/code&gt; for installs that exactly match your lockfile.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;code&gt;--if-present&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;npm run lint --if-present&lt;/code&gt; skips the step if the script doesn't exist, so the same file works on day one of a project and on day 500.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus: lint your workflows
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bash &amp;lt;&lt;span class="o"&gt;(&lt;/span&gt;curl &lt;span class="nt"&gt;-sL&lt;/span&gt; https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash&lt;span class="o"&gt;)&lt;/span&gt;
./actionlint
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;actionlint catches bad expressions, typos in action inputs and (with shellcheck installed) bugs in your &lt;code&gt;run:&lt;/code&gt; scripts before you push.&lt;/p&gt;

&lt;h2&gt;
  
  
  Get it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;ðŸ“„ Free commented version: &lt;a href="https://8686702537545.gumroad.com/l/sqjvco" rel="noopener noreferrer"&gt;https://8686702537545.gumroad.com/l/sqjvco&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;ðŸ“¦ If you want more, the &lt;strong&gt;ShipKit GitHub Actions Starter Pack&lt;/strong&gt; has 15 workflows (Python/Go CI, OS matrix, semver releases, Docker â†’ GHCR, Pages/Vercel/Fly deploys, CodeQL, Dependabot) plus repo templates: &lt;a href="https://8686702537545.gumroad.com/l/clhec" rel="noopener noreferrer"&gt;https://8686702537545.gumroad.com/l/clhec&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What's the one thing you always add to CI? Let me know in the comments.&lt;/p&gt;

</description>
      <category>githubactions</category>
      <category>node</category>
      <category>devops</category>
      <category>cicd</category>
    </item>
  </channel>
</rss>
