Skip to content

This Atipera recruitment task is a Quarkus-based application that fetches a GitHub user's public repositories, excluding forks, and retrieves branch names with the latest commit SHA.

Notifications You must be signed in to change notification settings

k4t4u/gh-task-atipera

Repository files navigation

GitHub Atipera Task

Table of Contents

  1. Description
  2. Requirements
  3. Configuration
  4. Running
  1. Testing
  2. Application Usage
  3. Final Notes

Description

The application retrieves information about a user's public GitHub repositories (excluding forks). For each repository, it returns:

  • repository name,
  • owner's login,
  • list of branches with branch names and the last commit SHA.

If the specified user does not exist, the application returns a 404 response in the format:

{
  "status": 404,
  "message": "User not found"
}

The application was built using:

  • Java
  • Quarkus 3
  • GitHub's REST API as an external data source
  • Includes an integration test verifying the happy path scenario

Requirements

  • Java 17 or higher
  • Maven 3.8+
  • Internet access when running the application

Note: GitHub has a rate limit for unauthorized requests. If higher limits are required, you can configure authentication with a token in the application.properties file. However, this is not mandatory.

Configuration

Minimal required configuration in the application.properties file:

# src/main/resources/application.properties
github-api/mp-rest/url=https://api.github.com

Running

Development mode

To quickly start the application in development mode:

mvn quarkus:dev

The application will be accessible at:

http://localhost:8080

Building and running as a JAR

Build the project:

mvn clean package

Run the generated JAR file:

java -jar target/quarkus-app/quarkus-run.jar

After running, the application will be accessible at:

http://localhost:8080

Testing

An integration test is provided in the GitHubResourceIT class. Run it with:

mvn test

The test verifies:

  • If the endpoint /github/{username} returns a list of repositories (non-forks).
  • If each repository has a name, an owner, and a list of branches with the last commit SHA.

Application Usage

Fetch user repositories

Endpoint: GET /github/{username}

Example URL:

http://localhost:8080/github/k4t4u

Example response:

[
  {
    "repositoryName": "app-brainGym",
    "ownerLogin": "k4t4u",
    "branches": [
      {
        "branchName": "main",
        "lastCommitSha": "e9f35054d4ae5a1f0c727a277fa130c01a444a08"
      }
    ]
  },
  {
    "repositoryName": "ideas100",
    "ownerLogin": "k4t4u",
    "branches": [
      {
        "branchName": "master",
        "lastCommitSha": "013ea931488226677a9c6e05e034897b125b9b62"
      },
      {
        "branchName": "test1",
        "lastCommitSha": "1d9fb69c12842f5adce74d78c347ca830189fa2c"
      }
    ]
  }
]

Handling non-existing user

The application returns a 404 status with:

{
  "status": 404,
  "message": "User not found"
}

Final Notes

  • Pagination is not implemented for GitHub requests and responses.
  • Only one integration test (happy path) is provided. In a production environment, more detailed tests and error handling would be recommended.
  • The project uses reactive programming with the Mutiny library (Uni<T> and Multi<T>).

About

This Atipera recruitment task is a Quarkus-based application that fetches a GitHub user's public repositories, excluding forks, and retrieves branch names with the latest commit SHA.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages