{"id":22024,"date":"2024-10-30T09:07:49","date_gmt":"2024-10-30T09:07:49","guid":{"rendered":"https:\/\/viewmyprojects.com\/winwirewp\/?p=22024"},"modified":"2024-10-30T09:09:59","modified_gmt":"2024-10-30T09:09:59","slug":"github-actions","status":"publish","type":"post","link":"https:\/\/viewmyprojects.com\/winwirewp\/blog\/github-actions\/","title":{"rendered":"An introduction to GitHub Actions"},"content":{"rendered":"\n<p>GitHub has become a core tool for developers around the world, helping them manage and collaborate on projects of all sizes. One of the most powerful features GitHub offers is GitHub Actions, which allows you to automate, customize, and execute your software development workflows directly from your GitHub repository. It enables continuous integration and continuous deployment (<a href=\"https:\/\/viewmyprojects.com\/winwirewp\/blog\/cicd-with-azure-devops-testproject\/\">CI\/CD<\/a>), allowing you to build, test, and deploy your code automatically whenever you push changes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Key Features of GitHub Actions<\/strong><\/h2>\n\n\n\n<ol start=\"1\" class=\"wp-block-list blog-detail-list\">\n<li><strong>Workflows<\/strong>: Defined in YAML files, workflows specify a series of tasks (jobs) that run in response to events like code pushes, pull requests, or on a schedule.<\/li>\n\n\n\n<li><strong>Jobs<\/strong>: A workflow can contain multiple jobs, which run in parallel or sequentially. Each job can execute commands, run scripts, or use actions.<\/li>\n\n\n\n<li><strong>Actions<\/strong>: Reusable units of code that perform specific tasks. You can create your own actions or use community-contributed ones from the GitHub Marketplace.<\/li>\n\n\n\n<li><strong>Triggers<\/strong>: Workflows can be triggered by various GitHub events, such as pushes, pull requests, releases, or even on a schedule.<\/li>\n\n\n\n<li><strong>Secrets<\/strong>: Securely store sensitive information (like API keys or passwords) to be used in your workflows without exposing them in your code.<\/li>\n\n\n\n<li><strong>Matrix Builds<\/strong>: Run your jobs in different environments or configurations simultaneously (e.g., different versions of a language or OS).<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Benefits of Using GitHub Actions<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list blog-detail-list\">\n<li><strong>Increased Efficiency\/ Automation<\/strong>: Automate repetitive tasks like testing and deployment, saving time and reducing errors. GitHub Actions allows you to automate repetitive tasks,&nbsp;reducing manual effort and minimizing errors.&nbsp;By automating such tasks as code testing and deployment,&nbsp;you can focus more on writing code and less on managing the development process.&nbsp;<\/li>\n\n\n\n<li><strong>Seamless Integration<\/strong>: Seamlessly integrates with your GitHub repositories, making it easy to implement CI\/CD. GitHub Actions seamlessly integrates with your GitHub repositories,&nbsp;enabling you to define workflows directly within your code base on GitHub.&nbsp;This tight integration ensures that your workflows are version&nbsp;controlled and easily accessible to your team with all of the&nbsp;other great features that GitHub offers.<\/li>\n\n\n\n<li><strong>Customizability<\/strong>: Highly customizable workflows to fit your specific project needs. With GitHub Actions,&nbsp;you have the flexibility to define custom workflows&nbsp;tailored to your specific requirements.&nbsp;So, whether you&#8217;re building a simple CI\/CD pipeline or&nbsp;orchestrating complex, multi\u2011step workflows, GitHub Actions can help you automate all of them.<\/li>\n\n\n\n<li><strong>Community<\/strong>: A large community and marketplace for actions, making it easy to find pre-built solutions.<\/li>\n\n\n\n<li><strong>Cost<\/strong>: Another benefit is that GitHub Actions are relatively cost\u2011effective.&nbsp;GitHub Actions provide generous free usage limits for all&nbsp;public repositories and includes a certain number of free&nbsp;minutes for private repositories.&nbsp;GitHub plans also offer free usage up to a certain&nbsp;limit depending on your plan choice.&nbsp;This makes it a cost\u2011effective option for teams and projects of all sizes,&nbsp;especially if you&#8217;re already using GitHub.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Use Cases &#8211; GitHub Actions<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list blog-detail-list\">\n<li><strong>Continuous Integration<\/strong>: Automatically run tests every time code is pushed to ensure code quality. Continuous integration is a software development practice&nbsp;where code changes are automatically built,&nbsp;tested, and integrated into the main code base frequently.&nbsp;GitHub Actions makes implementing CI pipelines seamlessly by&nbsp;allowing you to define workflows that automatically trigger&nbsp;on such events like a create, a push, or a schedule just to name a few.<\/li>\n\n\n\n<li><strong>Deployment<\/strong>: Automatically deploy code to a server or cloud provider when changes are merged into the main branch.<\/li>\n\n\n\n<li><strong>Notification<\/strong>: Send notifications (e.g., Slack messages) when specific events occur in your repository. &nbsp;We use it to notify team members or external systems when specific events occur,&nbsp;such as the creation of a new issue, a pull request,&nbsp;review request, or a deployment status update.&nbsp;We also use GitHub Actions on a schedule to send custom notifications to Slack,&nbsp;Microsoft Teams,&nbsp;and other communication channels to keep the team informed about weekly&nbsp;standup discussions and other team\u2011related information.<\/li>\n\n\n\n<li><strong>Automation<\/strong>: you can&nbsp;automate deployment and deploy your application to various environments,&nbsp;such as staging or production, based on predefined conditions or those&nbsp;event triggers.&nbsp;You can implement rollback mechanisms to revert the previous&nbsp;versions in case of deployment failures or issues.<\/li>\n<\/ul>\n\n\n\n<p>Some other common use cases include issue management,&nbsp;pull request automation, repository maintenance,&nbsp;and community engagement.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>How to create a GitHub Actions workflow<\/strong><\/h2>\n\n\n\n<p>Before we dive in and create a basic workflow file,&nbsp;let&#8217;s first understand the components within that file. A GitHub Actions workflow file is written in YAML and consists of several key components that define how the workflow operates. These workflows follow a specific structure and are stored in the&nbsp;<\/p>\n\n\n\n<p><strong>.github\/workflows<\/strong> directory of your GitHub repository.<\/p>\n\n\n\n<p>Here\u2019s an overview of the main components:<\/p>\n\n\n\n<p>So, let&#8217;s break down the main components of a workflow file.&nbsp;The first component we see is name.&nbsp;<\/p>\n\n\n\n<p><strong>1. Name<\/strong><\/p>\n\n\n\n<p>&nbsp;This is an optional field that provides a name for the workflow. The name component is a descriptive &nbsp;&nbsp;title for your workflow&nbsp;and can really be anything that you want.&nbsp;It&#8217;s a way to give your workflow a recognizable identity,&nbsp;making it easier for you and others to understand its purpose.<\/p>\n\n\n\n<p><strong>Example<\/strong>:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"492\" height=\"220\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-5.png\" alt=\"\" class=\"wp-image-22025\" style=\"width:328px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-5.png 492w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-5-300x134.png 300w\" sizes=\"auto, (max-width: 492px) 100vw, 492px\" \/><\/figure><\/div>\n\n\n<p><strong>2. on:<\/strong><\/p>\n\n\n\n<p>Specifies the events that trigger the workflow, such as pushes, pull requests, or scheduled events. It&#8217;s like setting up the conditions under which your workflow should run.&nbsp;And you can choose from a variety of events,&nbsp;such as pushes to the repository, pull requests,&nbsp;issue comments, and much more.&nbsp;<\/p>\n\n\n\n<p><strong>Example<\/strong>:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"789\" height=\"1024\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-7-789x1024.png\" alt=\"\" class=\"wp-image-22027\" style=\"width:314px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-7-789x1024.png 789w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-7-231x300.png 231w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-7-768x997.png 768w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-7.png 882w\" sizes=\"auto, (max-width: 789px) 100vw, 789px\" \/><\/figure><\/div>\n\n\n<p><strong>These events correspond to actions that occur in your repository:<\/strong><\/p>\n\n\n\n<ol style=\"list-style-type:lower-roman\" class=\"wp-block-list\">\n<li><strong>push<\/strong>: Triggers when code is pushed to the repository.<\/li>\n<\/ol>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"869\" height=\"197\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-8.png\" alt=\"\" class=\"wp-image-22028\" style=\"width:621px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-8.png 869w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-8-300x68.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-8-768x174.png 768w\" sizes=\"auto, (max-width: 869px) 100vw, 869px\" \/><\/figure><\/div>\n\n\n<p>      ii. <strong>pull_request<\/strong>: Triggers when a pull request is opened, synchronized, or reopened.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"869\" height=\"195\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-9.png\" alt=\"\" class=\"wp-image-22029\" style=\"width:633px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-9.png 869w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-9-300x67.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-9-768x172.png 768w\" sizes=\"auto, (max-width: 869px) 100vw, 869px\" \/><\/figure><\/div>\n\n\n<p>      iii. <strong>release<\/strong>: Triggers when a release is published or created.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"869\" height=\"154\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-10.png\" alt=\"\" class=\"wp-image-22030\" style=\"width:667px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-10.png 869w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-10-300x53.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-10-768x136.png 768w\" sizes=\"auto, (max-width: 869px) 100vw, 869px\" \/><\/figure><\/div>\n\n\n<p>      iv. <strong>issues<\/strong>: Triggers on issue events (e.g., opened, closed).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"876\" height=\"159\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-11.png\" alt=\"\" class=\"wp-image-22031\" style=\"width:664px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-11.png 876w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-11-300x54.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-11-768x139.png 768w\" sizes=\"auto, (max-width: 876px) 100vw, 876px\" \/><\/figure><\/div>\n\n\n<p><strong>        v. fork<\/strong>: Triggers when someone forks the repository.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"876\" height=\"83\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-12.png\" alt=\"\" class=\"wp-image-22032\" style=\"width:660px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-12.png 876w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-12-300x28.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-12-768x73.png 768w\" sizes=\"auto, (max-width: 876px) 100vw, 876px\" \/><\/figure><\/div>\n\n\n<p><strong>        vi<\/strong>. <strong>star<\/strong>: Triggers when someone stars the repository.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"870\" height=\"81\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-13.png\" alt=\"\" class=\"wp-image-22033\" style=\"width:670px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-13.png 870w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-13-300x28.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-13-768x72.png 768w\" sizes=\"auto, (max-width: 870px) 100vw, 870px\" \/><\/figure><\/div>\n\n\n<p>       vii. <strong>Schedule Events: <\/strong>You can set up workflows to run on a schedule using cron syntax. This event will only trigger a workflow run if the workflow file is on the default branch. Scheduled workflows will only run on the default branch.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"870\" height=\"100\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-14.png\" alt=\"\" class=\"wp-image-22034\" style=\"width:692px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-14.png 870w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-14-300x34.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-14-768x88.png 768w\" sizes=\"auto, (max-width: 870px) 100vw, 870px\" \/><\/figure><\/div>\n\n\n<p>Cron syntax has five fields separated by a space, and each field represents a unit of time.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"834\" height=\"398\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-15.png\" alt=\"\" class=\"wp-image-22035\" style=\"width:391px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-15.png 834w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-15-300x143.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-15-768x367.png 768w\" sizes=\"auto, (max-width: 834px) 100vw, 834px\" \/><\/figure><\/div>\n\n\n<p>You can use these operators in any of the five fields:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><td>Operator<\/td><td>Description<\/td><td>Example<\/td><\/tr><\/thead><tbody><tr><td>*<\/td><td>Any value<\/td><td>15 * * * *&nbsp;runs at every minute 15 of every hour of every day.<\/td><\/tr><tr><td>,<\/td><td>Value list separator<\/td><td>2,10 4,5 * * *&nbsp;runs at minute 2 and 10 of the 4th and 5th hour of every day.<\/td><\/tr><tr><td>&#8211;<\/td><td>Range of values<\/td><td>30 4-6 * * *&nbsp;runs at minute 30 of the 4th, 5th, and 6th hour.<\/td><\/tr><tr><td>\/<\/td><td>Step values<\/td><td>20\/15 * * * *&nbsp;runs every 15 minutes starting from minute 20 through 59 (minutes 20, 35, and 50).<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>      viii.<\/strong> <strong>Workflow Dispatch<\/strong>: It allows you to manually trigger the workflow from the GitHub UI. When using the&nbsp;workflow_dispatch&nbsp;event, you can optionally specify inputs that are passed to the workflow. This trigger only receives events when the workflow file is on the default branch. The triggered workflow receives the inputs in the&nbsp;inputs&nbsp;context (line 5). The maximum number of top-level properties for&nbsp;inputs&nbsp;is 10.<\/p>\n\n\n\n<p><strong>Example:<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"913\" height=\"465\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-16.png\" alt=\"\" class=\"wp-image-22036\" style=\"width:549px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-16.png 913w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-16-300x153.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-16-768x391.png 768w\" sizes=\"auto, (max-width: 913px) 100vw, 913px\" \/><\/figure><\/div>\n\n\n<p><strong>          ix. Repository Dispatch:&nbsp; <\/strong>repository_dispatch is a GitHub Actions event that allows you to trigger workflows from external sources or other GitHub repositories. This event can be used to send custom payloads and trigger workflows based on specific conditions.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Setup: You define a workflow in your repository that listens for the repository_dispatch event. This is done in your workflow YAML file:<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1010\" height=\"125\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-17.png\" alt=\"\" class=\"wp-image-22037\" style=\"width:802px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-17.png 1010w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-17-300x37.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-17-768x95.png 768w\" sizes=\"auto, (max-width: 1010px) 100vw, 1010px\" \/><\/figure><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Triggering the Event: To trigger the event, you can use the GitHub API. You need to make a POST request to the GitHub API endpoint, including a custom event type and any additional data you want to send in the payload.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"934\" height=\"264\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-18.png\" alt=\"\" class=\"wp-image-22038\" style=\"width:644px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-18.png 934w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-18-300x85.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-18-768x217.png 768w\" sizes=\"auto, (max-width: 934px) 100vw, 934px\" \/><\/figure><\/div>\n\n\n<ul class=\"wp-block-list\">\n<li>Handling the Event: Inside your workflow, you can access the client_payload to utilize the data sent with the event. This allows you to customize the behavior of your workflow based on the information received.<\/li>\n<\/ul>\n\n\n\n<p>        <strong>x.<\/strong> <strong>Filtering: <\/strong>You can further refine the triggering events using filters for branches, tags, and paths. For example:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"872\" height=\"225\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-19.png\" alt=\"\" class=\"wp-image-22040\" style=\"width:636px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-19.png 872w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-19-300x77.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-19-768x198.png 768w\" sizes=\"auto, (max-width: 872px) 100vw, 872px\" \/><\/figure><\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1007\" height=\"178\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-20.png\" alt=\"\" class=\"wp-image-22041\" style=\"width:639px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-20.png 1007w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-20-300x53.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-20-768x136.png 768w\" sizes=\"auto, (max-width: 1007px) 100vw, 1007px\" \/><\/figure><\/div>\n\n\n<p><strong>3. jobs<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Description<\/strong>: Contains a collection of jobs that will run as part of the workflow. Each job runs in its own environment.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"849\" height=\"115\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-21.png\" alt=\"\" class=\"wp-image-22042\" style=\"width:747px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-21.png 849w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-21-300x41.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-21-768x104.png 768w\" sizes=\"auto, (max-width: 849px) 100vw, 849px\" \/><\/figure><\/div>\n\n\n<p><strong>4. steps<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Description<\/strong>: A job consists of multiple steps, which can run commands, call actions, or run scripts.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"961\" height=\"477\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-22.png\" alt=\"\" class=\"wp-image-22043\" style=\"width:707px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-22.png 961w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-22-300x149.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-22-768x381.png 768w\" sizes=\"auto, (max-width: 961px) 100vw, 961px\" \/><\/figure><\/div>\n\n\n<ul class=\"wp-block-list blog-detail-list\">\n<li><strong>Uses:<\/strong> Indicates the action to be used in a step. Actions can be GitHub-hosted or custom.<\/li>\n\n\n\n<li><strong>Run:<\/strong> Specifies a command or script to execute in a step.<\/li>\n<\/ul>\n\n\n\n<p><strong>5. env<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Description<\/strong>: Define environment variables that can be used in steps.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"446\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-23.png\" alt=\"\" class=\"wp-image-22044\" style=\"width:614px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-23.png 956w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-23-300x140.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-23-768x358.png 768w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><\/figure><\/div>\n\n\n<p><strong>6. secrets<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Description<\/strong>: Allows access to secrets stored in the repository settings, used for sensitive data like API keys.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"146\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-24.png\" alt=\"GitHub\" class=\"wp-image-22045\" style=\"width:804px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-24.png 956w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-24-300x46.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-24-768x117.png 768w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><\/figure><\/div>\n\n\n<p><strong>7. outputs<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list blog-detail-list\">\n<li><strong>Description<\/strong>: Define outputs from a job that can be used in subsequent jobs. In GitHub Actions, output refers to the data that a step or job produces and can be used in subsequent steps or jobs within a workflow. Outputs allow you to pass information between different parts of your workflow.<\/li>\n\n\n\n<li><strong>Defining Outputs<\/strong>: You can define outputs in a job using the echo command in the shell, or in a step using the id property and outputs section.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1019\" height=\"373\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-25.png\" alt=\"\" class=\"wp-image-22046\" style=\"width:777px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-25.png 1019w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-25-300x110.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-25-768x281.png 768w\" sizes=\"auto, (max-width: 1019px) 100vw, 1019px\" \/><\/figure><\/div>\n\n\n<ul class=\"wp-block-list blog-detail-list\">\n<li><strong>Accessing Outputs<\/strong>: You can access outputs using the ${{ needs. &lt;job_id&gt;.outputs.&lt;output_id&gt; }} syntax, where &lt;job_id&gt; is the ID of the job that produced the output, and &lt;output_id&gt; is the ID of the output.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list blog-detail-list\">\n<li><strong>Job-level vs. Step-level Outputs<\/strong>: Outputs can be defined at both job and step levels. Job-level outputs can be shared with other jobs, while step-level outputs are accessible only within the same job.<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list blog-detail-list\">\n<li><strong>Using in Conditions<\/strong>: Outputs can also be used in conditional statements to determine whether a job or step should run.<\/li>\n\n\n\n<li><strong>Environment Variables<\/strong>: You can also set environment variables during a job, which can be used in subsequent steps but are not the same as outputs.<\/li>\n<\/ul>\n\n\n\n<p><strong>Some more example of Job Outputs:<\/strong><\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"447\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-26-1024x447.png\" alt=\"GitHub \" class=\"wp-image-22047\" style=\"width:760px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-26-1024x447.png 1024w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-26-300x131.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-26-768x336.png 768w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-26.png 1039w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n<p><strong>8. needs<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list blog-detail-list\">\n<li><strong>Description<\/strong>: Specifies dependencies between jobs, ensuring that a job runs only after the specified jobs have completed successfully. <strong>needs<\/strong> is a keyword used to define dependencies between jobs in a workflow. It ensures that a job only runs after its specified predecessor jobs have completed successfully. This is particularly useful for organizing workflows where certain tasks depend on the successful completion of others.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1019\" height=\"632\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-27.png\" alt=\"GitHub Actions \" class=\"wp-image-22048\" style=\"width:603px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-27.png 1019w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-27-300x186.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-27-768x476.png 768w\" sizes=\"auto, (max-width: 1019px) 100vw, 1019px\" \/><\/figure><\/div>\n\n\n<p><strong>Example Workflow File<\/strong><\/p>\n\n\n\n<p>Here\u2019s a simple example of a complete workflow file:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" width=\"1019\" height=\"1013\" src=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-28.png\" alt=\"GitHub Actions \" class=\"wp-image-22049\" style=\"width:641px;height:auto\" srcset=\"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-28.png 1019w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-28-300x298.png 300w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-28-150x150.png 150w, https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/image-28-768x763.png 768w\" sizes=\"auto, (max-width: 1019px) 100vw, 1019px\" \/><\/figure><\/div>\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>In summary, GitHub Actions enables you to focus on your core priorities: creating and innovating. By automating critical stages of the software lifecycle\u2014from integration through deployment\u2014GitHub Actions not only conserves time but also reduces the likelihood of mistakes.<\/p>\n\n\n\n<p>Whether you&#8217;re an individual developer or part of a larger team, its adaptability and seamless integration with GitHub make it indispensable for contemporary software development.<\/p>\n\n\n\n<p>Try it out and experience how much more efficient your workflows can be!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GitHub has become a core tool for developers around the world, helping them manage and collaborate on projects of all sizes. One of the most powerful features GitHub offers is GitHub Actions, which allows you to automate, customize, and execute your software development workflows directly from your GitHub repository. It enables continuous integration and continuous&hellip; <a class=\"more-link\" href=\"https:\/\/viewmyprojects.com\/winwirewp\/blog\/github-actions\/\">Continue reading <span class=\"screen-reader-text\">An introduction to GitHub Actions<\/span><\/a><\/p>\n","protected":false},"author":145,"featured_media":22089,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_eb_attr":"","_uag_custom_page_level_css":"","footnotes":""},"categories":[61,59,1],"tags":[],"class_list":["post-22024","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-app-modernization-blogs","category-blogs","category-uncategorized","entry"],"acf":[],"featured_image_src":"https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/Github-Actions.webp","author_info":{"display_name":"Anjali","author_link":"https:\/\/viewmyprojects.com\/winwirewp\/author\/anjali\/"},"views":1969,"uagb_featured_image_src":{"full":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/Github-Actions.webp",1667,917,false],"thumbnail":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/Github-Actions-150x150.webp",150,150,true],"medium":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/Github-Actions-300x165.webp",300,165,true],"medium_large":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/Github-Actions-768x422.webp",750,412,true],"large":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/Github-Actions-1024x563.webp",750,412,true],"1536x1536":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/Github-Actions-1536x845.webp",1536,845,true],"2048x2048":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/Github-Actions.webp",1667,917,false],"post-thumbnail":["https:\/\/viewmyprojects.com\/winwirewp\/wp-content\/uploads\/2024\/10\/Github-Actions-1568x863.webp",1568,863,true]},"uagb_author_info":{"display_name":"Anjali","author_link":"https:\/\/viewmyprojects.com\/winwirewp\/author\/anjali\/"},"uagb_comment_info":0,"uagb_excerpt":"GitHub has become a core tool for developers around the world, helping them manage and collaborate on projects of all sizes. One of the most powerful features GitHub offers is GitHub Actions, which allows you to automate, customize, and execute your software development workflows directly from your GitHub repository. It enables continuous integration and continuous&hellip;&hellip;","_links":{"self":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts\/22024","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/users\/145"}],"replies":[{"embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/comments?post=22024"}],"version-history":[{"count":10,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts\/22024\/revisions"}],"predecessor-version":[{"id":22099,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/posts\/22024\/revisions\/22099"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/media\/22089"}],"wp:attachment":[{"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/media?parent=22024"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/categories?post=22024"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/viewmyprojects.com\/winwirewp\/wp-json\/wp\/v2\/tags?post=22024"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}