DEV Community

Yevhen Fabizhevskyi
Yevhen Fabizhevskyi

Posted on

Introducing GitHub Actions Check Updates

Introduction

Working on a project it's important to have all your dependencies up-to-date. New versions have new features, bug fixes and many other improvements.

There are a lot of tools that helps us to keep all dependencies up-to-date. For maven projects we have Versions Maven Plugin, where we can run

mvn versions:display-dependency-updates
Enter fullscreen mode Exit fullscreen mode

and see something like:

[INFO] --- versions-maven-plugin:2.7:display-dependency-updates (default-cli) @ poe-runner ---
[INFO] The following dependencies in Dependency Management have newer versions:
[INFO]   com.github.fabasoad:commons-lang ...................... 0.2.3 -> 0.4.5
[INFO]   com.google.guava:guava .............................. 19.0 -> 29.0-jre
[INFO]   commons-cli:commons-cli ................................... 1.2 -> 1.4
Enter fullscreen mode Exit fullscreen mode

For npm projects there are many other tools like npm-check or npm-check-updates, where we can run ncu and see something like this:

PS C:\Projects\MyProject> ncu
Checking C:\Projects\MyProject\package.json
[====================] 42/42 100%

 @babel/core           7.8.7  →  7.9.0 
 @babel/preset-env     7.8.7  →  7.9.5 
 @babel/preset-react   7.8.3  →  7.9.4 
 babel-loader          8.0.6  →  8.1.0 
 firebase             7.10.0  →  7.14.2

Run ncu -u to upgrade package.json
Enter fullscreen mode Exit fullscreen mode

All such tools help us to keep our projects "healthy". But what about GitHub Actions? What if you have many workflow files with many GitHub Actions used there. It would be difficult to track all the versions manually. And here GitHub Actions Check Updates comes to help you 😉

GHACU

GitHub Actions Check Updates (GHACU) is a tool that helps you to keep versions of configured GitHub Actions up-to-date. Here is how it looks like in action:

PS C:\Projects\linguist-action> ghacu
> Dockerfile Lint (.github\workflows\dockerfile-lint.yml)
actions/checkout               v2.0.0  »  v2.1.0
burdzwastaken/hadolint-action  master  »   1.1.0

> Shell Lint (.github\workflows\shell-lint.yml)
actions/checkout                v1  »  v2.1.0
bewuethr/shellcheck-action  v2.0.1  »  v2.0.2

> YAML Lint (.github\workflows\yaml-lint.yml)
ibiqlik/action-yamllint  v0.0.2  »  v1.0.0

Run ghacu -u to upgrade actions.
Enter fullscreen mode Exit fullscreen mode

Installation

All what you need to do is to go to Releases page and download latest release based on OS that you have. It supports MacOS, Linux and Windows.

MacOS and Linux

# MacOS: ghacu-1.1.3-osx-x64.tgz
cd ~ && wget https://github.com/fabasoad/ghacu/releases/download/v1.1.3/ghacu-1.1.3-linux-x64.tgz
tar -xvf ghacu-1.1.3-linux-x64.tgz
cd ghacu-1.1.3-linux-x64
chmod 755 ghacu
PATH=$PATH:~/ghacu-1.1.3-linux-x64
Enter fullscreen mode Exit fullscreen mode

Windows

There are 2 options to install it on Windows:

  1. Install it in the same way as for Linux/MacOS - download package, unpack it and add path to PATH environment variable.
  2. Download executable file and just run it. Then add path to PATH environment variable.

Usage

Once you install the tool, open your favourite console and run the command below. You should see installed version if you installed it correctly:

PS C:\Projects\MyProject> ghacu --version
ghacu 1.1.3
Enter fullscreen mode Exit fullscreen mode

At this moment it supports two options:

PS C:\Projects\MyProject> ghacu --help
ghacu 1.1.3
Copyright (C) 2020 ghacu

  -r, --repository    Path to the root of a project.

  -u, --upgrade       Upgrade versions to the latest one.

  --help              Display this help screen.

  --version           Display version information.
Enter fullscreen mode Exit fullscreen mode

-r, --repository

It's a path to the project that has .github/workflows folder inside, e.g. C:\Projects\MyProject. If you do not define it, path will be the current path where you run ghacu. Result is the same in examples below.

PS C:\Projects\MyProject> ghacu
> CI (latest) (.github\workflows\ci-latest.yml)
actions/checkout  master  »  v2.1.0

> YAML Lint (.github\workflows\yaml-lint.yml)
ibiqlik/action-yamllint  v0.0.2  »  v1.0.0

Run ghacu -u to upgrade actions.
Enter fullscreen mode Exit fullscreen mode
PS C:\> ghacu -r "C:\Projects\MyProject"
> CI (latest) (.github\workflows\ci-latest.yml)
actions/checkout  master  »  v2.1.0

> YAML Lint (.github\workflows\yaml-lint.yml)
ibiqlik/action-yamllint  v0.0.2  »  v1.0.0

Run ghacu -u to upgrade actions.
Enter fullscreen mode Exit fullscreen mode

-u, --upgrade

Use this option if you want to update your actions to the newer versions. At first I propose you to run ghacu command without this option to see if newer versions look good to you and then run ghacu -u.

PS C:\Projects\MyProject> ghacu -u
> CI (latest) (.github\workflows\ci-latest.yml)
actions/checkout  master  »  v2.1.0

> YAML Lint (.github\workflows\yaml-lint.yml)
ibiqlik/action-yamllint  v0.0.2  »  v1.0.0
PS C:\Projects\MyProject> ghacu
All GitHub Actions match the latest versions.
Enter fullscreen mode Exit fullscreen mode

Conclusion

I hope you will enjoy using this tool. As for me, I started using it from the beta version and enjoy using it as well as improving it. Feel free to post any feature requests or bug reports to the Issues page, it will help me to keep making this tool better and better.

Future

There are a lot of ideas to implement:

  • Create choco, brew, apt-get, apk packages for easy installation.
  • Add progress indicator, like:
[=================---] 38/42 86%
Enter fullscreen mode Exit fullscreen mode
  • Add support of --revert, --parallel and many other features.
  • Add installation path to PATH environment variable automatically after installation.
  • Support different colors in console output text.
  • Many others.

It's written in C# .NET Core and if you are interested in contribution, you are very welcome to fork the repo and help to improve it 💻

Repository:
https://github.com/fabasoad/ghacu

Top comments (0)