This service captures a GitHub profile screenshot for a given username, emails the image to a recipient, and persists an operation record.
-
Capture
https://github.com/{githubUsername}(optionally after login ifwithLogin=true). - Email the PNG to
recipientEmail. -
Persist a
ScreenshotRecordwith:githubUsername,recipientEmail,fileName,filePath,fileSizeBytes,sentAt,status (SUCCESS/FAILED).
If withLogin=true, the service signs in with configured credentials and supports
GitHub Mobile approval (emails the mobile challenge screenshot). If OTP is enforced and cannot be
switched to Mobile, the request fails with a clear error.
Screenshots are saved in daily directories under the configured base dir
(GithubAutomationProperties.screenshotDir). Filenames are auto-suggested PNG names
from the username.
Uses JavaMailSender. Failures raise EmailSendException (503).
A paginated search API lists records with filters (username, email, status, date range, file size, filename, keyword).
Endpoints Summary
| Method | URL | Description | Request Body | Headers/Path | Response | Status Codes |
|---|---|---|---|---|---|---|
| POST | /api/github-screenshots |
Capture GitHub profile screenshot, email it, and persist a record | ScreenshotRequest |
— | CustomResponse<ScreenshotResponse> | 201, 400, 401*, 500 |
| POST | /api/github-screenshots/search |
Paged listing of screenshot records with filters | FilterServicePagingRequest |
— | CustomResponse<CustomPagingResponse<ScreenshotResponse>> | 200, 400 |
- Java 21
- Spring Boot 3.0
- Restful API
- Open Api (Swagger)
- Maven
- Junit5
- Mockito
- Integration Tests
- Docker
- Docker Compose
- CI/CD (Github Actions)
- Postman
- Prometheus
- Grafana
- Kubernetes
- JaCoCo (Test Report)
- AOP
Import postman collection under postman_collection folder
GITHUB_SCREENSHOT_DB_IP=localhost
GITHUB_SCREENSHOT_DB_PORT=3306
DATABASE_USERNAME={MY_SQL_DATABASE_USERNAME}
DATABASE_PASSWORD={MY_SQL_DATABASE_PASSWORD}
GMAIL_ADDRESS={your_gmail_email}
GMAIL_PASSWORD={gmail_authentication_password}
GITHUB_LOGIN_EMAIL={github_login_email}
GITHUB_LOGIN_PASSWORD={github_login_password}
http://localhost:1926/swagger-ui/index.html
After the command named mvn clean install completes, the JaCoCo report will be available at:
target/site/jacoco/index.html
Navigate to the target/site/jacoco/ directory.
Open the index.html file in your browser to view the detailed coverage report.
To build and run the application with Maven, please follow the directions shown below;
$ cd git clone https://github.com/Rapter1990/githubscreenshotmailer.git
$ cd githubscreenshotmailer
$ mvn clean install
$ mvn spring-boot:runThe application can be built and run by the Docker engine. The Dockerfile has multistage build, so you do not need to build and run separately.
Please follow directions shown below in order to build and run the application with Docker Compose file;
$ cd githubscreenshotmailer
$ docker-compose up -dIf you change anything in the project and run it on Docker, you can also use this command shown below
$ cd githubscreenshotmailer
$ docker-compose up --buildTo monitor the application, you can use the following tools:
-
Prometheus:
Open in your browser at http://localhost:9090
Prometheus collects and stores application metrics. -
Grafana:
Open in your browser at http://localhost:3000
Grafana provides a dashboard for visualizing the metrics.
Default credentials:- Username:
admin - Password:
admin
- Username:
Define prometheus data source url, use this link shown below
http://prometheus:9090
To run the application, please follow the directions shown below;
- Start Minikube
$ minikube start- Open Minikube Dashboard
$ minikube dashboard-
Revise
GITHUB_LOGIN_EMAILandGITHUB_LOGIN_PASSWORDingithub-credentials-secret.ymlandGMAIL_ADDRESSandGMAIL_PASSWORDingmail-secret.ymlaccording to your usage -
To deploy the application on Kubernetes, apply the Kubernetes configuration file underneath k8s folder
$ kubectl apply -f k8s- To open Prometheus, click tunnel url link provided by the command shown below to reach out Prometheus
minikube service prometheus-service- To open Grafana, click tunnel url link provided by the command shown below to reach out Prometheus
minikube service grafana-service- Define prometheus data source url, use this link shown below
http://prometheus-service.default.svc.cluster.local:9090
https://hub.docker.com/repository/docker/noyandocker/githubscreenshotmailer/general
