DEV Community

Johan Lindell
Johan Lindell

Posted on

Bulk-Migrate GitHub Actions from Node 20 to 24

If you manage a GitHub organization, you know the drill: GitHub announces a Node.js version deprecation, and suddenly your inbox is full of warnings.

With Node 20 hitting maintenance mode, you likely have dozens of .github/workflows files that need a version bump. You could clone each repo, edit the YAML, commit, push, and open a PR... fifty times.

Or, you can do it all in one go with multi-gitter.

The One-Shot Fix

multi-gitter is an open-source tool that allows you to run a script contextually inside every repository in your organization. It handles the cloning, branching, committing, and PR creation automatically.

Here is how to bump your Node versions across your entire org in under 3 minutes.

1. The Script

First, create a simple script called bump-node.sh. This script will run inside each repository. We'll use sed to find and replace the version number in your workflow files.

This script handles the syntax differences between macOS (BSD sed) and Linux (GNU sed) automatically.

#!/bin/bash

TARGET_DIR=".github/workflows"
SEARCH="node-version: 20"
REPLACE="node-version: 24"

# If the directory doesn't exist, stop here.
if [ ! -d "$TARGET_DIR" ]; then
    exit 0
fi

# Find YAML files and replace the version string
# We use a conditional check to ensure this works on both macOS and Linux
# "sed --version" returns 0 on GNU (Linux), but fails on BSD (macOS).
if sed --version >/dev/null 2>&1; then
    # Linux (standard GNU sed)
    find "$TARGET_DIR" -name "*.yml" -o -name "*.yaml" | xargs -I {} sed -i "s/$SEARCH/$REPLACE/g" {}
else
    # macOS (BSD sed)
    find "$TARGET_DIR" -name "*.yml" -o -name "*.yaml" | xargs -I {} sed -i '' "s/$SEARCH/$REPLACE/g" {}
fi
Enter fullscreen mode Exit fullscreen mode

Make sure to also give it execution permission with chmod +x ./bump-node.sh.

2. The Command

Run multi-gitter to execute this script across your organization (e.g., my-company-org).

multi-gitter run ./bump-node.sh \
  --org my-company-org \
  --branch upgrade-to-node-24 \
  --pr-title "Upgrade node version from 20 to 24" \
  --pr-body "Bumping node version to 24 in GitHub action due to deprecation."
Enter fullscreen mode Exit fullscreen mode

3. The Result

multi-gitter will iterate through your repositories. If the script makes a change (i.e., it finds a file to update), the tool will automatically:

  1. Fork/Clone the repo.
  2. Push the changes to the upgrade-to-node-24 branch.
  3. Open a Pull Request with your description.

You can even use the --interactive flag to review the changes in your terminal before the PRs are created.

Why this matters

Maintenance tasks like version bumps shouldn't eat up your sprint. By treating your entire GitHub organization as a single monorepo for these changes, you save hours of context switching.

Check out multi-gitter on GitHub to install it and see more recipes for bulk-managing your repositories.

Top comments (1)

Collapse
 
alexander_wen_dc3dd8153d5 profile image
Alexander Wen

hi