This post has been republished via RSS; it originally appeared at: Microsoft Developer Blogs.
In this post, App Dev Managers Bernard Apolinario, Sujith Nair, and Latha Natarajan give a thorough overview of GitHub Actions.GitHub Actions enables you to create custom workflows directly in your GitHub repository. You can discover, create, and share actions to perform any job you'd like, including CI/CD, and combine actions in a completely customized workflow. You can create continuous integration (CI) workflows that build, and test projects written in different programming languages. GitHub Actions for JavaScript and TypeScript GitHub Actions for Python GitHub Actions for Java GitHub Actions for Docker Workflows run in Linux, macOS, Windows, and containers on GitHub-hosted machines, called 'runners'. Alternatively, you can also host your own runners to run workflows on machines you own or manage. For more information see, "About self-hosted runners."
Workflows
A workflow is a configurable automated process made up of one or more jobs. You can setup workflows in your repository to build, test, package, release, or deploy any project on GitHub. Workflows are stored in the .github/workflows directory in the root of your repository. There is a requirement to have at least one job in a workflow. A job contains a set of steps that perform tasks (Commands or Actions) Workflows can be configured to start when:- An event occurs on GitHub
- a commit is pushed
- issue or pull is requested
- A scheduled event begins
- An external event occurs
Matrix builds
GitHub Actions saves you time by allowing you to test on multiple operating systems, platforms, and language versions at the same time using a build matrix. You can create a matrix to run workflows on more than one operating system. You can also specify more than one matrix configuration. This example creates a matrix of 6 jobs:- 2 operating systems specified in the os array
- 3 Node.js versions specified in the node array
Live logs
GitHub Actions allows you to see your workflow run in real-time. If your workflow run fails, you can see the step that caused the failure and review the failed steps build logs. The duration for each step is logged. A link to the specific line in the log file is shareable with your team when troubleshooting. The full build logs and artifacts for a workflow run is available for 90 days. (Read-level access can perform this function) To review the logs:- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Actions.
- In the left sidebar, click the workflow you want to see.
- Under "Workflow runs", click the name of the run you want to see.
- In the left sidebar, click the job you want to see.
- To expand the log for a failed step, click the step.
- Optionally, to get a link to a specific line in the logs, click on the step's line number. You can copy the link from the address bar of your web browser.
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Actions.
- In the left sidebar, click the workflow you want to see.
- Under "Workflow runs", click the name of the run you want to see.
- In the left sidebar, click the job you want to see.
- To expand each step, you want to include in your search, click the step.
- In the upper-right corner of the log output, in the Search logs search box, type a search query.
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Actions.
- In the left sidebar, click the workflow you want to see.
- Under "Workflow runs", click the name of the run you want to see.
- To download logs, use the Download logs drop-down menu, and select the logs you want to download.
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Actions.
- In the left sidebar, click the workflow you want to see.
- Under "Workflow runs", click the name of the run you want to see.
- To delete the log files, click the Delete all logs button and review the confirmation prompt.
Built-in secret store
Secrets are encrypted variables that you create in a repository or organization. The secrets created are used within the GitHub Action workflows. The secrets could be login credentials, configuration settings, or any sensitive value that would be used by the workflow tasks. You can securely connect to an Azure subscription using a service principal generated via the Azure CLI. The encrypted secret output of the command can be safely stored in the GitHub Actions built-in secret store. The access to secrets can be for all repositories or limited to only private repositories or a list of repositories.- To create secrets at the organization level, you must have admin access.
- To create secrets for a user account repository, you must be the repository owner.
- To create secrets using the REST API, you must have “write” access to the repository. For more information, see "GitHub Actions secrets API."
- On GitHub, navigate to the main page of the repository.
- Under your repository name, click Settings.
- In the left sidebar, click Secrets.
- Click Add a new secret.
- Type a name for your secret in the Name input box.
- Enter the value for your secret.
- Click Add secret.
Community-powered workflows
One of the important features of GitHub Actions is the ability to re-use existing workflows or build on thousands of free community created actions. You can extend and improve your GitHub workflows by utilizing free and paid tools. GitHub has partnered with industry leading solution providers to include:- Atlassian for automating JIRA
- Twilio for sending SMS messages in your workflow
- Cloudflare for deploying a Cloudflare Worker
- SonarCloud for scanning code quality
- JFrog for setting up and configuring the JFrog CLI
- Mabl for automated functional testing
- Actions Label Commenter - Automatically adds a label based on a templated message.
- Actions Comment Run - Allows you to run any script in a GitHub issue comment. Program your bot to say “hello, world”, post an image or gif, add links, run a command, and more.
- Misspell Fixer - Automatically fixes typos and mistakes in your source code and docs
- TODO to Issue - Converts your #TODO comments to GitHub issues when a new comment is added