Maison  >  Article  >  outils de développement  >  les actions github doivent-elles être sur la branche principale

les actions github doivent-elles être sur la branche principale

Patricia Arquette
Patricia Arquetteoriginal
2024-10-09 15:19:15477parcourir

Do Github actions need to be on the main branch to run?

No, GitHub actions do not need to be on the main branch to run. GitHub actions can be configured to run on any branch or tag in your repository. To specify which branches or tags an action should run on, use the on keyword in your workflow file. For example:

<code class="yaml">on:
  push:
    branches: [main, develop]</code>

This workflow will run whenever there is a push to either the main or develop branch.

Are Github actions only triggered when they are on the main branch?

No, GitHub actions are not only triggered when they are on the main branch. GitHub actions can be triggered by a variety of events, including:

  • Pushes to branches or tags
  • Pull requests
  • Issues
  • Releases
  • Schedules
  • Webhooks

You can specify which events should trigger an action in your workflow file. For example:

<code class="yaml">on:
  push:
    branches: [main, develop]
  pull_request:
    branches: [main]</code>

This workflow will run whenever there is a push to the main or develop branches, or when a pull request is opened against the main branch.

Does the location of a Github action affect when it runs?

No, the location of a GitHub action does not affect when it runs. GitHub actions can be run on any of GitHub's hosted runners, or on your own self-hosted runners. The location of the runner will not affect when the action starts running, or how long it takes to complete.

Ce qui précède est le contenu détaillé de. pour plus d'informations, suivez d'autres articles connexes sur le site Web de PHP en chinois!

Déclaration:
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn