GitHub Action - ghdrako/doc_snipets GitHub Wiki

GitHub Actions are event driven, so a workflow is triggered based on specific events such as a new pull request being opened or a new commit being pushed to the repository, just to name a few. Every event triggers a workflow. A workflow can have one or more jobs, and a job can include a series of steps to build, test, package, or release on GitHub or elsewhere.

GitHub Actions run on servers called runners. Runners have the GitHub Actions runner application installed on them, listening for commands. GitHub provides hosted runners, but you can run your own runners. This is especially useful if you have compliance requirements to build the software in your own environment. The steps to be performed as part of the pipeline are defined using a file known as the Actions Workflow file. The workflow file uses a YAML- based specification to define the events, jobs, and steps that need to be run, with support for conditionals to allow for specific jobs to run when conditions are met. For GitHub Actions to pick up and run a workflow, GitHub expects these workflow files to be saved in the .github/workflows directory at the root of the repository.

Syntax https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions

name: Run compose
on: [push]
jobs:
run-compose:
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Start containers
run: docker-compose version

Save this file as .github/workflows/compose.yaml, commit the files, and push this to the GitHub repo. Once you push the commit to the remote repository, GitHub should start the workflow immediately. From your GitHub repository page, click the Actions tab, and you can see the result of the workflow.

GitHub has a CLI tool that can give you feedback without having to open a tab and navigate to actions. To get started, you need to install the GitHub CLI, as mentioned in https://cli. github.com/. Once the CLI is installed, open a new terminal session. Authenticate with GitHub by typing the following command:

gh auth login
cd <repo>
gh workflow list
gh workflow view <workflow id>
gh run view <run id>
gh run view --job <job id>
⚠️ **GitHub.com Fallback** ⚠️