GitHub Actions — Customize the Job Name

GitHub Actions provide a convenient way to run your application tests. You can also run a test matrix with different dependency versions. For example, a test matrix can consist of three Node.js and two MongoDB versions. The test suite will then run against all combinations of Node.js and MongoDB versions.

This tutorial shows you how to create a job name representing the combined dependencies. You’ll create a job name in the format of Node {node-version} - MongoDB {mongodb-version}.

GitHub Actions Series Overview

Customize the Job Name

By default, GitHub Actions use the job key as an identifier in the web UI. The identifier in the following example is test because it’s the only key in the list of jobs in the YAML configuration.

You can change the name for a job by providing a name property. You can access all the metadata in the job configuration.

The following workflow configuration assigns a job name consisting of the Node.js and MongoDB version:

name: Run tests

on: [push, pull_request]

    runs-on: ubuntu-latest
        node-version: [12.x, 13.x]
        mongodb-version: [4.0, 4.2]

    name: Node.js ${{ matrix.node-version }} - MongoDB ${{ matrix.mongodb-version }}

    - name: …

The testing matrix defines two versions of the Node.js and MongoDB dependencies. Using a customized name lets you identify which combination failed in your test suite.

The following screenshot shows GitHub’s web UI before using a custom job name:

GitHub Action using the default job name

And here’s the GitHub web UI using a job name consisting of the used Node.js and MongoDB version:

GitHub Action using a custom job name

The explicit naming helps you to quickly identify individual jobs in the testing matrix.

Explore the Library

Find interesting tutorials and solutions for your problems.