Github Actions#
Github Actions is an automation tool integrated with Github.
Understanding Github Actions#
- Here is a repo with some common examples and getting started links!
- YouTube: Github Actions CI/CD - Everything you need to know to get started
- Official Understanding Actions Docs. These are paraphrased below.
- Verified Actions in the Marketplace -
[Required]
Github maintains a directory of pre-made actions to use. Actions must be from Verified creators, they will have a Badge on the Marketplace page.- If an action doesn't have one, we recommend searching for another one that is verified, or reach out to the creator. The process to get verified is reasonable and documented here
- Here are some additional information about security and 3rd party actions
Workflows#
Workflows and Actions or generally interchangeable terms.
"A workflow is a configurable automated process that will run one or more jobs. Workflows are defined by a YAML file checked in to your repository and will run when triggered by an event in your repository, or they can be triggered manually, or at a defined schedule." (citation)
Workflows are placed in the .github/workflows/
directory at the root of your repository.
Understanding the Workflow File
Actions#
Prepackaged Github Actions workflows can be found in the Actions Marketplace in the 'Actions' tab for every repo. You can also create custom Actions.
Events#
Events are configured to trigger workflows. These can be schedules, changes to branches, the completion of other workflows, and much more. Github has thorough documentation on Workflow triggers and Events.
Schedules#
Schedules are a specific Event trigger based on POSIX cron syntax.
Schedules are highly recommended, especially when combined with dependabot, to keep builds up-to-date. It will also help to give advance warning of any version/dependency issues and avoid "surprises" when returning to a project that has sat stale for months. If you have multiple builds that are similar we also recommend scheduling one to run on the runs-on: arc-runner-enterprise-beta
runner to avoid any surprises when the production runners are updated (more information here)
Things to note: - Schedules only work on actions in the Main branch - If you run multiple daily schedules, stagger the start times by 10-15 minutes or so This applies to both Github hosted runners and Devex provided runners.
Jobs#
Jobs are the work defined to be done in a workflow. Jobs run concurrently unless configured otherwise.
- Using Jobs in a Workflow
- Conditional Job Execution
- Using Job Environments
- Running Jobs in a Container
- Setting Default Values
- And More!
Runners#
Runners are the servers that run Jobs.
See Action Runners page for more information.
Composite Actions#
Composite Actions are actions that are grouped together to be easily reused. Conmposite actions live in their own separate repo, here is an example, and get called in a different workflow in another repo. Here is an example of the composite action being used.
Use Cases and Examples#
helloworld.yml#
name: hello-world
on: push # trigger
jobs:
my-job:
runs-on: ubuntu-latest # A Github Hosted Runner
steps:
- name: my-step
run: echo "Hello World!"
Docs#
DevEx uses Actions to deploy this docs site. See Github Pages page.
Dependabot#
See Dependabot Page