{"id":2001,"date":"2022-06-25T12:00:00","date_gmt":"2022-06-25T10:00:00","guid":{"rendered":"https:\/\/kindsonthegenius.com\/blog\/what-is-github-action-how-to-set-set-it-up\/"},"modified":"2026-08-28T14:31:02","modified_gmt":"2026-08-28T12:31:02","slug":"what-is-github-action-how-to-set-set-it-up","status":"publish","type":"post","link":"https:\/\/kindsonthegenius.com\/blog\/what-is-github-action-how-to-set-set-it-up\/","title":{"rendered":"What Is Github Action \u2013 How to Set it Up"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><em>Learn what Github Action is and how to set it up with a Spring Boot application, Maven workflow, Super Linter, and multiple operating systems.<\/em><\/p>\n\n\n<h3>TL;DR<\/h3>\n<ul>\n<li>\n<p>Github Action lets you automate development workflows based on events such as pushes and pull requests.<\/p>\n<\/li>\n<li>\n<p>A workflow is defined in a YAML file and contains the steps to perform when an event occurs.<\/p>\n<\/li>\n<li>\n<p>The <strong>Java With Maven<\/strong> workflow can automatically build a Spring Boot application.<\/p>\n<\/li>\n<li>\n<p><strong>Super Linter<\/strong> can be added as a separate workflow to validate code.<\/p>\n<\/li>\n<li>\n<p>Github Action workflows can run in parallel across multiple operating systems using a matrix strategy.<\/p>\n<\/li>\n<\/ul>\n<p>In this tutorial, you will understand Github action and how to set it up.<\/p>\n<p>We would create a simple Spring Boot application locally, build it and push it to Github. Then we would create a Github action that triggers the build anytime a push is made to the repository.<\/p>\n<p>Next, will show you how to use Super Linter to validate your code using Github actions.<\/p>\n<p>Lets follow the steps<\/p>\n<ol>\n<li><a href=\"#t1\">Create a SpringBoot Application and Push to Github<\/a><\/li>\n<li><a href=\"#t2\">Setup Java CI With Maven Workflow<\/a><\/li>\n<li><a href=\"#t3\">Github Action with Super Linter Workflow<\/a><\/li>\n<li><a href=\"#t4\">Multiple Operating Systems<\/a><\/li>\n<\/ol>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t1\">1. Create a Spring Application and Push to Github<\/strong><\/h4>\n<p><strong>Step 1<\/strong> \u2013 Create a new Spring Boot application.<\/p>\n<p><strong>Step 2<\/strong> \u2013 In the terminal, run the command<\/p>\n<p><em>mvn clean install<\/em><\/p>\n<p>And make sure the application builds successfully.<\/p>\n<p><strong>Step 3<\/strong> \u2013 Create a new Github repository and push the code to the repository.<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t2\">2. Setup Java CI With Maven Workflow<\/strong><\/h4>\n<p>What we would like to do is to setup GitHub actions. An action is a collection of Workflow where a workflow is a definition of the steps to perform when a given event occurs. A workflow is defined in a YAML file. But you don\u2019t need to write this from the scratch. There\u2019s already tons of pre-written workflows you can choose from and with very little adjustment, you can get it to give the desired result.<\/p>\n<p>Follow the steps below:<\/p>\n<p><strong>Step 1<\/strong> \u2013 Open your code repository in Github and click on the Actions tab as shown below<\/p>\n<figure id=\"attachment_14885\" class=\"wp-caption aligncenter\" style=\"width: 812px;\" aria-describedby=\"caption-attachment-14885\"><a href=\"https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-25-at-21.30.42.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-14885 size-full\" src=\"https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-25-at-21.30.42.png\" sizes=\"auto, (max-width: 812px) 100vw, 812px\" srcset=\"https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-25-at-21.30.42.png 812w, https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-25-at-21.30.42-300x130.png 300w, https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-25-at-21.30.42-768x332.png 768w, https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-25-at-21.30.42-600x259.png 600w\" alt=\"Github Actions tab\" width=\"812\" height=\"351\" \/><\/a>\n<figcaption id=\"caption-attachment-14885\" class=\"wp-caption-text\">Github Actions tab<\/figcaption>\n<\/figure>\n<p>&nbsp;<\/p>\n<p><strong>Step 2<\/strong> \u2013 In the list of Worflows, find \u201cJava With Maven\u201d as shown below ( you can also search using the search field). This workflow contains the template for building Java projects with Maven.<\/p>\n<figure id=\"attachment_14889\" class=\"wp-caption aligncenter\" style=\"width: 654px;\" aria-describedby=\"caption-attachment-14889\"><a href=\"https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-25-at-23.38.35.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-14889\" src=\"https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-25-at-23.38.35.png\" sizes=\"auto, (max-width: 654px) 100vw, 654px\" srcset=\"https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-25-at-23.38.35.png 654w, https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-25-at-23.38.35-300x141.png 300w, https:\/\/www.kindsonthegenius.com\/wp-content\/uploads\/2022\/06\/Screenshot-2022-06-25-at-23.38.35-600x282.png 600w\" alt=\"\" width=\"654\" height=\"307\" \/><\/a>\n<figcaption id=\"caption-attachment-14889\" class=\"wp-caption-text\">Java With Maven Workflow<\/figcaption>\n<\/figure>\n<p>&nbsp;<\/p>\n<p><strong>Step 3<\/strong> \u2013 Click on Configure. This would display the workflow configuration file in yml. We could actually edit this file later. But for now it\u2019s fine. Notice the structure of the file. The event that triggers the workflow is specified in the on: section. (<a href=\"https:\/\/youtu.be\/9G_z9iadAW0\" target=\"_blank\" rel=\"noopener\">I explain the rest in the video<\/a>). In this case, the workflow would trigger on:<\/p>\n<ul>\n<li>push<\/li>\n<li>pull request<\/li>\n<\/ul>\n<p><strong>Step 4<\/strong> \u2013 Click on the Start Commit button to commit this file. Note that a workflow file is actually placed inside your repository in a special directory \u2013 .github\/worflows\/&lt;file.yml&gt;. In our case, it is maven.yml.<\/p>\n<p><strong>Step 5<\/strong> \u2013 Now go back to your IDE. First do a pull to update your local repository. Then make some changes and push back to Github. You will notice that the workflow triggers and the build is run.<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t3\">3. Github Action Using Super Linter Workflow<\/strong><\/h4>\n<p>Super Linter is a tool that you can use to check your code to make sure it is syntactically correct. Note that you can add multiple workflows. Now we would add the Super Linter workflow as a second workflow. Follow the steps<\/p>\n<p><strong>Step 1<\/strong> \u2013 Go to Action and click on <strong>New Workflow.<\/strong><\/p>\n<p><strong>Step 2<\/strong> \u2013 Search for Super Linter.<\/p>\n<p><strong>Step 3<\/strong>\u2013 Follow the same procedure to add the Super Linter workflow. Notice that once you commit, it triggers the existing workflow as well.<\/p>\n<p><strong>Step 4<\/strong> \u2013 Test out this workflow by pushing code with bug and see that it fails with a red mark.<\/p>\n<p>&nbsp;<\/p>\n<h4><strong id=\"t4\">4. Github Actions in Parallel on different OS<\/strong><\/h4>\n<p>If you notice, you see that the basic maven.yml file has as workflow that runs the build on ubuntu-latest. You can also adjust this to allow the build to run on multiple operating sytems in parallel.<\/p>\n<p>To do that, adjust the runs on section of the workflow file to include three operating systems like so;<\/p>\n<pre style=\"margin: 0; line-height: 125%;\">    runs-on: ${{matrix.os}}\n    strategy: \n      matrix:\n        os: [ubuntu-latest, windows-latest, macOS-latest]\n<\/pre>\n<p>&nbsp;<\/p>\n<p>Once you do this, you can go ahead to modify your code in the IDE and push, you will notice that the three runs in parallel.<\/p>\n<h3>FAQs<\/h3>\n<p><strong>What is Github Action?<\/strong><\/p>\n<p>Github Action is a way to automate development workflows in a GitHub repository. Workflows can be triggered by events such as pushes and pull requests.<\/p>\n<p><strong>What is a Github Action workflow?<\/strong><\/p>\n<p>A workflow is a YAML file that defines the steps to perform when a specific event occurs. Workflow files are stored in the <code>.github\/workflows<\/code> directory.<\/p>\n<p><strong>How do I set up Github Action for a Spring Boot application?<\/strong><\/p>\n<p>Create and push your Spring Boot application to GitHub, open the repository&#8217;s <strong>Actions<\/strong> tab, select the <strong>Java With Maven<\/strong> workflow, configure it, and commit the workflow file.<\/p>\n<p><strong>What is Super Linter in Github Action?<\/strong><\/p>\n<p>Super Linter is a workflow that checks code to help identify syntax and formatting problems. It can be added as a separate workflow alongside the Maven build workflow.<\/p>\n<p><strong>Can Github Action run on multiple operating systems?<\/strong><\/p>\n<p>Yes. A workflow can use a matrix strategy to run the same build across operating systems such as Ubuntu, Windows, and macOS in parallel.<\/p>\n<h3>Final Thoughts<\/h3>\n<p>Github Action provides a simple way to automate common software development tasks directly from a GitHub repository. With a workflow, you can automatically build your Spring Boot application whenever code is pushed or a pull request is created.<\/p>\n<p>You can also add workflows such as Super Linter to validate your code and configure builds to run across multiple operating systems. These capabilities make Github Action useful for automating builds, testing, and code quality checks as part of your development workflow.<\/p>\n<p><a href=\"https:\/\/youtu.be\/9G_z9iadAW0\" target=\"_blank\" rel=\"noopener\">Video tutorial on Working With Github Actions<\/a><\/p>\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn what Github Action is and how to set it up with a Spring Boot application, Maven workflow, Super Linter, and multiple operating systems.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"categories":[414],"tags":[],"class_list":["post-2001","post","type-post","status-publish","format-standard","hentry","category-programming"],"acf":[],"_links":{"self":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/2001","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/comments?post=2001"}],"version-history":[{"count":3,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/2001\/revisions"}],"predecessor-version":[{"id":2572,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/posts\/2001\/revisions\/2572"}],"wp:attachment":[{"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/media?parent=2001"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/categories?post=2001"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kindsonthegenius.com\/blog\/wp-json\/wp\/v2\/tags?post=2001"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}