AI Hints
Home›CI/CD with GitHub Actions Tutorial›Templates and Shared Workflows
CI/CD with GitHub Actions · Lesson 115 of 138

Workflow Templates

Starter workflows.

⏱ 2 min read▶ Video at 2:14:04🎓 Free
Watch this lesson in the CI/CD with GitHub Actions courseWatch on YouTube ↗Full CI/CD with GitHub Actions course

When someone creates a new repository in your organization, they shouldn't start from a blank file. Workflow templates appear on the Actions tab, as ready made starters, written the way your team likes.

Workflow Templates
From the video: Workflow Templates
  • New repos, blank files
  • Templates on the Actions tab
  • Your team's way

A template

Templates live in a repository called dot github, in a folder called workflow templates. This one is a normal workflow. The only special part is dollar default branch, which GitHub replaces with the new repository's main branch name.

.github/workflow-templates/python-ci.ymlyaml
name: Python CI
on:
  push:
    branches: [ $default-branch ]
  pull_request:
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with: { python-version: "3.12" }
      - run: pip install -r requirements.txt
      - run: pytest -q

Template files

Each template has a matching properties file, in JSON. It gives the name and description shown on the Actions tab, an icon, and file patterns, so GitHub can suggest it for Python projects. Templates are copied once, so for shared logic that keeps updating, use reusable workflows instead.

keyvalue
python-ci.ymlthe workflow
python-ci.properties.jsonname, description
filePatternswhen to suggest
Copied oncenot kept in sync

Summary

Workflow templates give new repositories a good starting pipeline, from the dot github repository. Next, practice with a shared workflow.

Key takeaways
  • .github repo
  • workflow-templates/
  • $default-branch
Next up: Practice: A Shared Workflow — one workflow, many callers