Skip to main content

Using workflow templates

GitHub provides workflow templates for a variety of languages and tooling.

About workflow templates

Workflow templates are templates that help you to create your own GitHub Actions workflows for a repository. They offer an alternative to starting from a blank workflow file and are useful because some of the work will already have been done for you.

GitHub offers workflow templates for a variety of languages and tooling. When you set up workflows in your repository, GitHub analyzes the code in your repository and recommends workflows based on the language and framework in your repository. For example, if you use Node.js, GitHub will suggest a workflow template file that installs your Node.js packages and runs your tests. You can search and filter to find relevant workflow templates.

GitHub fournit des modèles de workflows prêts à l’emploi pour les catégories de haut niveau suivantes :

  • Intégration continue (CI) . Pour plus d’informations, consultez « À propos de l’intégration continue avec GitHub Actions ».
  • Automatisation. Les modèles de workflows d’automatisation offrent des solutions pour automatiser les workflows, comme le triage des demandes de tirage (pull requests) et l’application d’une étiquette en fonction des chemins d’accès qui sont modifiés dans la demande de tirage ou l’accueil des utilisateurs qui sont contributeurs au référentiel pour la première fois.

Utilisez ces workflows comme point de départ pour générer votre propre workflow ou utilisez-les tels quels. Vous pouvez parcourir la liste complète des modèles de flux de travail dans le référentiel actions/starter-workflows.

You can also create your own workflow template to share with your organization. These workflow templates will appear alongside the GitHub-provided workflow templates. Anyone with write access to the organization's .github repository can set up a workflow template. For more information, see Creating workflow templates for your organization.

Choosing and using a workflow template

  1. Sur GitHub, accédez à la page principale du référentiel.

  2. Sous le nom de votre dépôt, cliquez sur Actions.

    Capture d’écran des onglets du référentiel « github/docs ». L’onglet « Actions » est mis en surbrillance avec un encadré orange.

  3. Si vous disposez déjà d’un workflow dans votre dépôt, cliquez sur Nouveau workflow.

  4. The "Choose a workflow" page shows a selection of recommended workflow templates. Find the workflow template that you want to use, then click Configure. To help you find the workflow template that you want, you can search for keywords or filter by category.

  5. If the workflow template contains comments detailing additional setup steps, follow these steps.

    There are guides to accompany many of the workflow templates for building and testing projects. For more information, see Building and testing.

  6. Some workflow templates use secrets. For example, ${{ secrets.npm_token }}. If the workflow template uses a secret, store the value described in the secret name as a secret in your repository. For more information, see Using secrets in GitHub Actions.

  7. Optionally, make additional changes. For example, you might want to change the value of on to change when the workflow runs.

  8. Click Start commit.

  9. Write a commit message and decide whether to commit directly to the default branch or to open a pull request.

Further reading