Nota: Los ejecutores hospedados en GitHub no son compatibles con GitHub Enterprise Server actualmente. Puedes encontrar más información sobre el soporte que se tiene planeado en el futuro en el Itinerario público de GitHub.
Resumen de ejemplo
This article uses an example workflow to demonstrate some of the main CI features of GitHub Actions. Cuando se activa este flujo de trabajo, este ejecuta automáticamente un script que verifica si el sitio de GitHub Docs tiene enlaces rotos. Si se encuentra algún enlace roto, el flujo de trabajo utiliza el CLI de GitHub para crear una propuesta de GitHub con los detalles.
The following diagram shows a high level view of the workflow's steps and how they run within the job:
Características utilizadas en este ejemplo
The example workflow demonstrates the following capabilities of GitHub Actions:
Característica | Implementación |
---|---|
Running a workflow at regular intervals: | schedule |
Setting permissions for the token: | permissions |
Preventing a job from running unless specific conditions are met: | if |
Referencing secrets in a workflow: | Secrets |
Cloning your repository to the runner: | actions/checkout |
Installing node on the runner: | actions/setup-node |
Using a third-party action: | peter-evans/create-issue-from-file |
Ejemplo de flujo de trabajo
The following workflow was created by the GitHub Docs Engineering team. To review the latest version of this file in the github/docs
repository, see check-all-english-links.yml
.
Note: Each line of this workflow is explained in the next section at "Understanding the example."
|
Cómo entender el ejemplo
The following table explains how each of these features are used when creating a GitHub Actions workflow.
Código | Explicación |
---|---|
|
The name of the workflow as it will appear in the "Actions" tab of the GitHub repository. |
|
Define a
|
|
Modifica los permisos predeterminados que se otorgan al |
|
Agrupa todos los jobs que se ejecutan en el archivo de flujo de trabajo. |
|
Define un job con la ID |
|
Solo ejecuta el job |
|
Configura el job para ejecutarse en un ejecutor Ubuntu Linux. Esto significa que el job se ejecutará en una máquina virtual nueva hospedada en GitHub. Para obtener ejemplos de sintaxis utilizando otros ejecutores, consulta la sección "Sintaxis de flujo de trabajo para las GitHub Actions". |
|
Crea variables de ambiente personalizadas y redefine la variable integrada |
|
Agrupa todos los pasos que se ejecutarán como parte del job |
|
La palabra clave |
|
Este paso utiliza la acción |
|
La palabra clave |
|
Este comando de |
|
Si el script |
|
Utiliza la acción |
|
Utiliza Entonces se utiliza |
|
Si se abre una propuesta de una ejecución anterior y se le asigna a alguien, utiliza entonces [ |
|
Si la propuesta de una ejecución previa está abierta y no está asignada a nadie, entonces:
|
Pasos siguientes
- To learn about GitHub Actions concepts, see "Understanding GitHub Actions."
- For more step-by-step guide for creating a basic workflow, see "Quickstart for GitHub Actions."
- If you're comfortable with the basics of GitHub Actions, you can learn about workflows and their features at "About workflows."