🎓 A1Learner
🔍
0 of 50 lessons completed

GitHub Actions: Workflow Templates

A workflow template is a ready-made workflow for a common task. GitHub offers one for Node, Python and many other stacks.

Start from a template

Choose a template from the Actions tab.

Set up a workflow yourself
Node.js
Python application

The Node.js template

It installs Node and runs the tests.

- uses: actions/setup-node@v7
  with:
    node-version: '24'
- run: npm test

Change one thing

Set the Node version to 24, the version this course uses.

node-version: '24'

Example

name: Node.js CI

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-node@v7
        with:
          node-version: '24'
      - run: npm test

Key points

  • A template is a starting point, not a finished workflow.
  • Use the Node.js template to test a Node app.
  • The template sets up Node and runs the tests.
  • Change one thing at a time, then push and watch the run.
  • The template file is saved as node.js.yml.
  • Templates save typing. The workflow is still yours to change.

In this example, the workflow comes from the Node.js template. The job is called build, as the template names it. The steps fetch the code, install Node 24, and run the tests. The template install step is left out. The demo app has no extra packages to install. The run ends with both tests passing.

Note

A template can set a Node version you do not want. Check the version line before you push.

Try it Yourself

Edit the code, then press Run.

Running is simulated · Rust Playground

Exercise

What is a workflow template?