10 of Our Favorite Actions for GitHub Actions
GitHub’s addition of Actions has seen its community build useful tasks that plug right into your repository. Here are 10 of our favorite GitHub Actions, plus how to install them.
Join the DZone community and get the full member experience.
Join For FreeAlthough relatively new to the world of continuous integration (CI), GitHub’s adding of Actions has seen its strong community build useful tasks that plug right into your repository.
Actions let you run non-standard tasks to help you test, build, and push your work to your deployment tools.
In no particular order, here are 10 of our favorites, plus how to install them.
1. Test Reporter
Showing all your test results in GitHub, the test reporter action helps keep the important parts of your code and testing processes in one place. Providing the results in XML or JSON formats as part of a ‘check run’, this action tells you where your code failed with useful stats.
Test reporter already supports most of the popular testing tools for the likes of .NET, JavaScript, and more. Plus, you can add more by raising an issue or contributing yourself.
Supported frameworks:
- .NET: xUnit, NUnit, and MSTest
- Dart: test
- Flutter: test
- Java: JUnit
- JavaScript: JEST and Mocha
2. Build and Push Docker Images
Doing what the title says, the build and push Docker images action lets you build and push Docker images.
Using Buildx and Moby BuildKit features, you can create multi-platform builds, test images, customize inputs and outputs, and more.
Check out the action’s page for the full list of features, including advanced use and how to customize it.
3. Setup PHP
The Setup PHP action allows you to set up PHP extensions and .ini files for application testing on all major operating systems.
It’s also compatible with tools like GitHub’s composer, PHP-config, Symfony, and more. See the marketplace page for the full list of compatible tools.
4. GitTools Actions
The GitTools Action allows you to use both GitVersion and GitReleaseManager in your pipeline.
GitVersion helps solve common versioning problems with semantic versioning (also known as ‘Semver’), for consistency across your projects. GitVersion helps avoid duplication, saves rebuilding time, and much more. Benefiting CI, it creates version numbers that labels builds and makes variables available to the rest of your pipeline.
Meanwhile, GitReleaseManager automatically creates, attaches, and publishes exportable release notes.
If you only need the versioning of GitVersion, there is an alternative action with the same name later in this list.
5. Action Automatic Releases
Once set to react to the GitHub events of your choosing (such as commits to your main branch), the action automatic releases workflow can:
- Auto-upload assets
- Create changelogs
- Create a new release
- Set the project to ‘pre-release’
6. Repository Dispatch
The repository dispatch action makes it easier to trigger actions from a 'repository dispatch' event. Plus, it lets you trigger and chain the actions from one or more repositories.
You need to create a personal access token for this action to work as GitHub won’t support it by default.
7. PullPreview
The PullPreview action allows you to preview pull requests by spinning up live environments for code reviews.
When making a pull with the "pullpreview" label, this action checks out your code and deploys to an AWS Lightsail instance with Docker and Docker Compose.
This allows you to play with your new features as your customers would, or to show off working models of your ideas.
It also promises compatibility with your existing tools and full integration with GitHub.
The only thing you should be aware of is that you need to buy a license if using it with commercial products.
8. ReportGenerator
The ReportGenerator action can extract the most useful parts of coverage reports into easier-to-read formats. It allows you to read your data in the likes of HTML, and XML, plus various text summaries and language-specific formats.
9. Git Version
While a little like the GitVersion tool enabled by the GitTools action, this Git version is an action itself.
Like the external tool, however, it offers simple Semver versioning to help track your different releases. This is useful if you only want help versioning and don’t need GitReleaseManager.
10. GitHub Action Tester (github-action-tester)
The github-action-tester is an action that lets you kick off shell scripts for testing.
After it's installed, just add your scripts to your repository and kick them off with the events you need.
How to Install Actions
Installing actions in GitHub is simple:
- Find the action you want on the GitHub Marketplace.
- Read the Marketplace page to check for prerequisites.
- Click Use latest version in the top right (or select an older version if you need).
- Copy the code from the pop-up, paste it into your repository’s .yml file, and save.
- Make sure you read the action’s documentation to check for any extra setup and how to use the action.
What Next?
If the actions we chose don’t suit your project or you need something outside the scope of CI, there's plenty more to choose from. Search through the GitHub marketplace for more.
Happy deployments!
Published at DZone with permission of Andy Corrigan. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments