Blog Infos

In the story we will see how to create a workflow for Android Lint using GitHub Actions.

Photo by Roman Synkevych on Unsplash

Before moving to the workflow I want to quickly go over GitHub Actions and Android Lint.

Github Actions

During Android or any development you might have come across different CI/CD frameworks that you can use to automate the processes or delivery pipelines e.g build, test and distribute. GitHub Actions provides a convenient way to create your workflows and automate your process right from your repository.

Some of the benefits that I see while working in GitHub Actions

  • Github Actions are attached to your repository in Github, you don’t need to manage an extra third party platform to build and manage your CI/CD. Your code is in GitHub, your CI/CD is in GitHub.
  • Github Actions give more controls to developers minimising the need of having a separate DevOps team to manage CI/CD.
  • While creating workflows using GitHub Actions, It provides startup workflows to choose from for quick start, e.g for Android there is Android CI workflow already provided for quick help.
  • Github Marketplace where almost 20K actions are already available to use which you can choose and Add/Modify into your repository right away.
  • Github Actions are customisable you can achieve almost everything you want to automate.

To Read more about Github Actions, follow the the official documentations from the link.

Android Lint

We write and build Tests to make sure functional requirements are met properly but It’s also equally important to inspect your code to identify structural problems in the code. lint tool helps in identifying structural and static issues in the code which can impact efficiency and reliability of the code and possible optimisation to improve code security, correctness, performance, usability etc

Android Studio provides a built-in lint tool which runs when you build your App but you can also manually execute it using Code —> Inspect Code option in Android Studio or also using command line ./gradlew lint .

Whenever lint tool runs, it checks the source code against lint.xml file available in the root folder of the project. If lint.xml does not exist then all lint supported issues are checked. We provide lint.xml files mentioning issues which we want lint tool to ignore or customise lint checks for certain issues.

You can add annotations in the code to notify lint to check such rules during lint inspection. e.g such annotations are @StringRes ,@Nullable , @NonNull , @RequiredPermission etc.

How to add annotations and what different kinds of annotations are? You can see official documentations Improve code inspection using annotations.

Overview of how lint processes source code.

Image Source: official documentation Improve your code with lint checks

For further details you can follow the official documentations

Why should we create workflow for Android Lint?

As the team grows or we have multiple teams managing the same codebase e.g feature teams, core team etc, maintaining code quality gets complex.

If we don’t have workflows and everyone is self responsible for running and fixing Android Lint individually or any other static analyser then things might get skip on day to day basis due to priorities or other related dependencies or human error or some other reason etc

When code is committed to the repository you can write a workflow which will run on every commit, enabling continuous integration to build and test the code making sure it does not break anything and does not introduce new errors. You can write multiple workflows for different cases e.g one for build and test, the other for deployment, the other for Android lint checks etc.

workflows enables Continuous Integrations(CI) where everyone can commit frequently to the shared repository as the code will get checked on every commit (or as per need) ensuring code quality, also it makes easier to merge changes, enabling members of the team to focus more on writing code rather than fixing merge conflicts or debugging errors etc.

Below we will see how to create a workflow for Android Lint using Github Actions.

Android Lint workflow using Github Actions

Lets create workflow which will run lint code inspector on every pull request created on main branch and when code is pushed to main branch.

Create a .github folder and then workflows folder inside like that .github/workflows .

We write Github workflows in yml file, creating an empty android-lint.yml file inside .github/workflows .

Then set the name of the workflow as below.

We want to run workflow when code is pushed or a pull request is created from main branch.

Running actual job on workflow

Job Offers

Job Offers

There are currently no vacancies.



From Chaos to Consistency: Managing Build and Release for 25+ Android Repos with Github Actions

Managing the build and release process for over 25 Android repositories can be a daunting task. With each repository having its own pipeline or workflow, it can become difficult to ensure consistency and quality across…
Watch Video

From Chaos to Consistency: Managing Build and Release for 25+ Android Repos with Github Actions

Shrikant Ballal
Staff Engineer

From Chaos to Consistency: Managing Build and Release for 25+ Android Repos with Github Actions

Shrikant Ballal
Staff Engineer

From Chaos to Consistency: Managing Build and Release for 25+ Android Repos with Github Actions

Shrikant Ballal
Staff Engineer


It defines a job named android-lint and configures it to run on ubuntu-latest, that means it will run on linux runner hosted by Github.

Next to create steps inside the job, first we have to checkout the code using Github action actions/checkout@v3 as below.

Setting-up JDK version 17
Run Android Lint.

It will run Android Linter as soon as we create a pull request for main branch or when code is pushed to main branch.

The complete android-lint.yml file is below.

name: Android Lint
run-name: Running Android Lint
- 'main'
- 'main'
runs-on: ubuntu-latest
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Run Lint
run: ./gradlew lint
continue-on-error: false

That’s it for now. I hope it was helpful.

Remember to follow and 👏 if you liked it 🙂

— — — — — — — — — — —

GitHub | LinkedIn | Twitter

This article was previously published on



Life is hard. We are engulfed in tasks that take time, are boring, and…
As a developer working on various Kotlin Multiplatform projects, whether for your job or…
There are a lot of blogs and videos on why we need CI/CD. From…
To release an Android app to the public, every Android Developer needs to build…

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.