Skip to main content

Diese Version von GitHub Enterprise Server wurde eingestellt am 2025-06-04. Es wird keine Patch-Freigabe vorgenommen, auch nicht für kritische Sicherheitsprobleme. Für bessere Leistung, verbesserte Sicherheit und neue Features aktualisiere auf die neueste Version von GitHub Enterprise Server. Wende dich an den GitHub Enterprise-Support, um Hilfe zum Upgrade zu erhalten.

Creating workflow templates for your organization

Learn how you can create workflow templates to help people in your team add new workflows more easily.

Hinweis

Auf GitHub gehostete Runner werden aktuell nicht auf GitHub Enterprise Server unterstützt. Weitere Informationen zur geplanten zukünftigen Unterstützung findest Du in der GitHub public roadmap.

Overview

Mit Workflowvorlagen können alle Personen in deiner Organisation, die über die entsprechenden Berechtigungen verfügen, Workflows schneller und leichter erstellen. Bei der Erstellung eines neuen Workflows kann eine Workflowvorlage ausgewählt werden, die Ihnen das Schreiben des Workflows ganz oder teilweise abnimmt. Workflowvorlagen können als Ausgangspunkt verwendet werden, um eigene benutzerdefinierte Workflow zu erstellen, oder unverändert übernommen werden. So sparst du nicht nur Zeit, sondern sorgst auch für Konsistenz und den Einsatz bewährter Methoden in deiner Organisation.

GitHub bietet einsatzbereite Workflowvorlagen für die folgenden Kategorien auf hoher Ebene:

  • Bereitstellung (CD) . Weitere Informationen finden Sie unter Info zu Continuous Deployment mit GitHub Actions.

  • Continuous Integration (CI) Weitere Informationen finden Sie unter Info zu Continuous Integration mit GitHub Actions.

  • Automatisierung. Automatisierungs-Workflowvorlagen bieten Lösungen für die Automatisierung von Workflows, wie z. B. die Triage von Pull Requests und das Anwenden einer Bezeichnung basierend auf den Pfaden, die im Pull Request geändert werden, oder das Begrüßen von Benutzern, die zum ersten Mal Mitwirkende des Repositorys sind.

Hinweis

Because workflow templates require a public .github repository, they are not available for Enterprise Managed Users.

Creating a workflow template

Workflow templates can be created by users with write access to the organization's public .github repository. These can then be used by organization members who have permission to create workflows.

Hinweis

To avoid duplication among workflow templates you can call reusable workflows from within a workflow. This can help make your workflows easier to maintain. For more information, see Reusing workflows.

This procedure demonstrates how to create a workflow template and metadata file. The metadata file describes how the workflow templates will be presented to users when they are creating a new workflow.

  1. If it doesn't already exist, create a new public repository named .github in your organization.

  2. Create a directory named workflow-templates.

  3. Create your new workflow file inside the workflow-templates directory.

    If you need to refer to a repository's default branch, you can use the $default-branch placeholder. When a workflow is created the placeholder will be automatically replaced with the name of the repository's default branch.

    Hinweis

    The following values in the runs-on key are also treated as placeholders:

    • "ubuntu-latest" is replaced with "[ self-hosted ]"
    • "windows-latest" is replaced with "[ self-hosted, windows ]"
    • "macos-latest" is replaced with "[ self-hosted, macOS ]"

    For example, this file named octo-organization-ci.yml demonstrates a basic workflow.

    YAML
    name: Octo Organization CI
    
    on:
      push:
        branches: [ $default-branch ]
      pull_request:
        branches: [ $default-branch ]
    
    jobs:
      build:
        runs-on: ubuntu-latest
    
        steps:
          - uses: actions/checkout@v4
    
          - name: Run a one-line script
            run: echo Hello from Octo Organization
    
  4. Create a metadata file inside the workflow-templates directory. The metadata file must have the same name as the workflow file, but instead of the .yml extension, it must be appended with .properties.json. For example, this file named octo-organization-ci.properties.json contains the metadata for a workflow file named octo-organization-ci.yml:

    JSON
    {
        "name": "Octo Organization Workflow",
        "description": "Octo Organization CI workflow template.",
        "iconName": "example-icon",
        "categories": [
            "Go"
        ],
        "filePatterns": [
            "package.json$",
            "^Dockerfile",
            ".*\\.md$"
        ]
    }
    
    • name - Required. The name of the workflow. This is displayed in the list of available workflows.

    • description - Required. The description of the workflow. This is displayed in the list of available workflows.

    • iconName - Optional. Specifies an icon for the workflow that is displayed in the list of workflows. iconName can one of the following types:

      • An SVG file that is stored in the workflow-templates directory. To reference a file, the value must be the file name without the file extension. For example, an SVG file named example-icon.svg is referenced as example-icon.
      • An icon from GitHub's set of Octicons. To reference an octicon, the value must be octicon <icon name>. For example, octicon smiley.
    • categories - Optional. Defines the categories that the workflow is shown under. You can use category names from the following lists:

    • filePatterns - Optional. Allows the workflow to be used if the user's repository has a file in its root directory that matches a defined regular expression.

To add another workflow template, add your files to the same workflow-templates directory.

Next steps

To continue learning about GitHub Actions, see Using workflow templates.