<?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: h6o</title>
    <description>The latest articles on DEV Community by h6o (@newbee1939).</description>
    <link>https://dev.to/newbee1939</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2614752%2F849d325f-b04f-4468-90b7-4a0eededb872.jpg</url>
      <title>DEV Community: h6o</title>
      <link>https://dev.to/newbee1939</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/newbee1939"/>
    <language>en</language>
    <item>
      <title>Automatically Merge Dependabot Patch Updates with GitHub Actions</title>
      <dc:creator>h6o</dc:creator>
      <pubDate>Wed, 03 Dec 2025 00:25:28 +0000</pubDate>
      <link>https://dev.to/newbee1939/automatically-merge-dependabot-patch-updates-with-github-actions-316g</link>
      <guid>https://dev.to/newbee1939/automatically-merge-dependabot-patch-updates-with-github-actions-316g</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Dependabot automatically detects dependency updates and creates pull requests, but manually merging each one can be tedious.&lt;/p&gt;

&lt;p&gt;Patch updates (security fixes and bug fixes) typically have limited impact, making them safe candidates for automatic merging.&lt;/p&gt;

&lt;p&gt;This article explains how to implement a GitHub Actions workflow that automatically merges Dependabot patch updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Workflow Overview
&lt;/h2&gt;

&lt;p&gt;The following workflow automatically merges only patch updates (&lt;code&gt;version-update:semver-patch&lt;/code&gt;) from Dependabot pull requests:&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;Dependabot auto-merge&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;pull_request_target&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="s"&gt;opened&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;synchronize&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;reopened&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ready_for_review&lt;/span&gt;

&lt;span class="na"&gt;permissions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;{}&lt;/span&gt;

&lt;span class="na"&gt;defaults&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="na"&gt;shell&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bash&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;dependabot&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;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;github.event.pull_request.user.login == 'dependabot[bot]'&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;write&lt;/span&gt;
      &lt;span class="na"&gt;pull-requests&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;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;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Fetch Dependabot metadata&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;metadata&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;dependabot/fetch-metadata@v2&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;github-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GITHUB_TOKEN }}&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;Auto-merge Dependabot patch updates&lt;/span&gt;
        &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;steps.metadata.outputs.update-type == 'version-update:semver-patch'&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;gh pr merge --merge --auto "$PR_URL"&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;PR_URL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ github.event.pull_request.html_url }}&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.GITHUB_TOKEN }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Detailed Explanation of Each Step
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Trigger Configuration
&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;on&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;pull_request_target&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="s"&gt;opened&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;synchronize&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;reopened&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;ready_for_review&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;pull_request_target&lt;/code&gt;: Runs in the context of the branch where the pull request was created. This allows proper access to Dependabot's pull requests with the necessary permissions.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;opened&lt;/code&gt;: When a pull request is created&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;synchronize&lt;/code&gt;: When new commits are pushed to the pull request&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;reopened&lt;/code&gt;: When a closed pull request is reopened&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ready_for_review&lt;/code&gt;: When a draft pull request becomes ready for review&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Job Condition
&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;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;github.event.pull_request.user.login == 'dependabot[bot]'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This condition ensures the job only runs for pull requests created by Dependabot. It prevents accidental automatic merging of pull requests created by other users.&lt;/p&gt;

&lt;h3&gt;
  
  
  Permission Settings
&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;write&lt;/span&gt;
  &lt;span class="na"&gt;pull-requests&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;write&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;contents: write&lt;/code&gt;: Write access to the repository (required for merging)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;pull-requests: write&lt;/code&gt;: Pull request operation permissions (required for merging)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 1: Fetch Dependabot Metadata
&lt;/h3&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;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Fetch Dependabot metadata&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;metadata&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;dependabot/fetch-metadata@v2&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;github-token&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ secrets.GITHUB_TOKEN }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;dependabot/fetch-metadata@v2&lt;/code&gt; action retrieves metadata about Dependabot's pull request. This action outputs information such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;update-type&lt;/code&gt;: Type of update (&lt;code&gt;version-update:semver-patch&lt;/code&gt;, &lt;code&gt;version-update:semver-minor&lt;/code&gt;, &lt;code&gt;version-update:semver-major&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;dependency-names&lt;/code&gt;: Names of the dependencies being updated&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;directory&lt;/code&gt;: Directory where the update occurred&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 2: Auto-merge Patch Updates
&lt;/h3&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;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Auto-merge Dependabot patch updates&lt;/span&gt;
  &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;steps.metadata.outputs.update-type == 'version-update:semver-patch'&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;gh pr merge --merge --auto "$PR_URL"&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;PR_URL&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ github.event.pull_request.html_url }}&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.GITHUB_TOKEN }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;if&lt;/code&gt; condition: Only executes when the update type is a patch update (&lt;code&gt;version-update:semver-patch&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;gh pr merge --merge --auto&lt;/code&gt;: Uses GitHub CLI to merge the pull request

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;--merge&lt;/code&gt;: Creates a merge commit to merge&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;--auto&lt;/code&gt;: Automatically merges once all checks pass&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setup Instructions
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Create the Workflow File
&lt;/h3&gt;

&lt;p&gt;Save the workflow above in &lt;code&gt;.github/workflows/dependabot-auto-merge.yml&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Verify Dependabot Configuration
&lt;/h3&gt;

&lt;p&gt;Ensure Dependabot is enabled in &lt;code&gt;dependabot.yml&lt;/code&gt; or in your GitHub repository settings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Notes and Best Practices
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Why Only Auto-merge Patch Updates?
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Patch updates (1.0.0 → 1.0.1)&lt;/strong&gt;: Bug fixes and security patches. Safe to auto-merge as they don't contain breaking changes&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Minor updates (1.0.0 → 1.1.0)&lt;/strong&gt;: New features added. May have broader impact, so review is recommended&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Major updates (1.0.0 → 2.0.0)&lt;/strong&gt;: Likely to contain breaking changes. Manual review is essential&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;By implementing this workflow, you can automatically merge Dependabot patch updates and quickly apply security patches and bug fixes. Patch updates typically don't contain breaking changes, making them safe for automatic merging.&lt;/p&gt;

&lt;p&gt;However, we recommend adjusting the auto-merge conditions based on your project's characteristics and team policies. Consider customizing the workflow for critical dependencies by requiring manual reviews or adding additional checks.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>github</category>
      <category>automation</category>
      <category>devops</category>
    </item>
    <item>
      <title>3 ways to speed up CI [GitHub Actions] that you can do immediately!</title>
      <dc:creator>h6o</dc:creator>
      <pubDate>Thu, 26 Dec 2024 23:02:54 +0000</pubDate>
      <link>https://dev.to/newbee1939/3-ways-to-speed-up-ci-github-actions-that-you-can-do-immediately-28cc</link>
      <guid>https://dev.to/newbee1939/3-ways-to-speed-up-ci-github-actions-that-you-can-do-immediately-28cc</guid>
      <description>&lt;p&gt;&lt;strong&gt;For those&lt;/strong&gt; who are frustrated by slow CI execution.&lt;/p&gt;

&lt;p&gt;Here are three ways to speed up CI execution with GitHub Actions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three ways to speed up CI [GitHub Actions].
&lt;/h2&gt;

&lt;p&gt;The following three methods are introduced in this article.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Split the Job&lt;/li&gt;
&lt;li&gt;Adding package cache processing&lt;/li&gt;
&lt;li&gt;Split tests and run them in parallel&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Split a Job
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Jobs can be split so that each job runs in parallel&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example, the execution of a unit test and the execution of a Linter can often run independently.&lt;/p&gt;

&lt;p&gt;It would be more efficient to describe them in separate Jobs, rather than in series in a single Job.&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="s"&gt;jobs:.&lt;/span&gt;
  &lt;span class="s"&gt;test:.&lt;/span&gt;
    &lt;span class="s"&gt;runs-on&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-22.04&lt;/span&gt;
    &lt;span class="s"&gt;steps:.&lt;/span&gt;
    &lt;span class="s"&gt;...&lt;/span&gt;

  &lt;span class="s"&gt;lint&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;...&lt;/span&gt;
    &lt;span class="s"&gt;runs-on&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;ubuntu-22.04&lt;/span&gt;
    &lt;span class="s"&gt;steps&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;...&lt;/span&gt;
    &lt;span class="s"&gt;...&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Add package caching process.
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Packages are recommended to be cached to skip the time-consuming package installation process&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Use the official &lt;a href="https://github.com/actions/cache" rel="noopener noreferrer"&gt;actions/cache&lt;/a&gt; to implement the cache process.&lt;/p&gt;

&lt;p&gt;In the following cases, &lt;code&gt;npm ci&lt;/code&gt; will only be executed if there is a change in the OS, Node version or the file that manages package information (package-lock.json), otherwise the cache will be used.&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;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;cache and restore packages&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;cache-npm&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/cache@v4.0.2&lt;/span&gt;
  &lt;span class="na"&gt;with&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;node_modules&lt;/span&gt;
    &lt;span class="s"&gt;path&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;node_modules&lt;/span&gt;
    &lt;span class="s"&gt;key&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt; &lt;span class="s"&gt;${{ runner.os }}-${{ steps.tool_versions.outputs.nodejs }}-${{ hashFiles(‘**/package-lock.json’) }}&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;install npm packages&lt;/span&gt;
  &lt;span class="na"&gt;if&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;steps.cache-npm.outputs.cache-hit ! = ‘true’&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="na"&gt;shell&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;bash&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Split and run tests in parallel
&lt;/h3&gt;

&lt;p&gt;If your tests take a long time to run, you can speed up the process by &lt;strong&gt;dividing the tests and running each one in parallel&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;For example, in the case of Jest, you can use the &lt;a href="https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/running-variations-of-jobs-in-a-workflow" rel="noopener noreferrer"&gt;matrix strategy&lt;/a&gt; and the command option &lt;a href="https://jestjs.io/docs/cli#--shard" rel="noopener noreferrer"&gt;--shard&lt;/a&gt;. The &lt;code&gt;matrix strategy&lt;/code&gt; is a simple and easy way to split up tests and run them in parallel.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;matrix strategy&lt;/code&gt; is a method to run a Job for each value defined in a variable within a single Job, and &lt;code&gt;--shard&lt;/code&gt; is an option to split tests.&lt;/p&gt;

&lt;p&gt;Using these, you can define a workflow like the following.&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;test&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-22.04&lt;/span&gt;
    &lt;span class="na"&gt;strategy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;matrix&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;shard&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="pi"&gt;[&lt;/span&gt;&lt;span class="nv"&gt;1/4&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;2/4&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;3/4&lt;/span&gt;&lt;span class="pi"&gt;,&lt;/span&gt; &lt;span class="nv"&gt;4/4&lt;/span&gt;&lt;span class="pi"&gt;]&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;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;checkout&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@v3&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;setup environment&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="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;run test&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;npx jest --ci --shard=${{ matrix.shard }}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will run &lt;strong&gt;4 Jobs in parallel, each running a quarter of the tests&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I don't know if there are other options like &lt;code&gt;--shard&lt;/code&gt; besides Jest, but the idea itself can be applied to any language.&lt;/p&gt;

&lt;h2&gt;
  
  
  There are other ways.
&lt;/h2&gt;

&lt;p&gt;The following three methods were introduced as easy ways to improve the speed of CI.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Split the Job&lt;/li&gt;
&lt;li&gt;Add package cache processing&lt;/li&gt;
&lt;li&gt;Split tests and run them in parallel&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, in addition to these, you can also use &lt;a href="https://docs.github.com/en/actions/using-github-hosted-runners/using-larger-runners/about-larger-runners" rel="noopener noreferrer"&gt;larger runner&lt;/a&gt; and running tests only in areas where changes have been made, there are many other ways to improve speed.&lt;/p&gt;

&lt;p&gt;It is recommended to improve the speed little by little to the extent possible, recognising the time and financial resources available.&lt;/p&gt;

</description>
      <category>githubactions</category>
      <category>cicd</category>
      <category>performance</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
