Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/MartinHeinz/go-github-app
Template for building GitHub Apps in Go.
https://github.com/MartinHeinz/go-github-app
github-api github-app go golang
Last synced: 3 months ago
JSON representation
Template for building GitHub Apps in Go.
- Host: GitHub
- URL: https://github.com/MartinHeinz/go-github-app
- Owner: MartinHeinz
- License: mit
- Created: 2021-12-29T13:47:04.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T10:00:45.000Z (about 2 years ago)
- Last Synced: 2024-08-04T08:05:32.758Z (7 months ago)
- Topics: github-api, github-app, go, golang
- Language: Go
- Homepage:
- Size: 49.8 KB
- Stars: 65
- Watchers: 4
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Template for GitHub Apps built with Golang
[](https://github.com/MartinHeinz/go-github-app/workflows/Build,%20Test,%20Lint/badge.svg)
[](https://github.com/https://github.com/MartinHeinz/go-github-app/workflows/Release/badge.svg)
[](https://sonarcloud.io/summary/new_code?id=MartinHeinz_go-github-app)
[](https://codeclimate.com/github/MartinHeinz/go-github-app/maintainability)
[](https://codeclimate.com/github/MartinHeinz/go-github-app/test_coverage)
[](https://goreportcard.com/report/github.com/MartinHeinz/go-github-app)--------------
If you find this useful, you can support me on Ko-Fi (Donations are always appreciated, but never required):
[](https://ko-fi.com/K3K6F4XN6)
## Blog Posts - More Information About This Repo
You can find more information about this project/repository and how to use it in following blog post:
[Building GitHub Apps with Golang](https://martinheinz.dev/blog/65)
## Quick Start
To use this repository as starter for your project you can run configure_project.sh script, which sets up all variables and file names. This way you can avoid configuring and renaming things yourself:
```bash
./configure_project.sh \
APP_ID="54321" \
INSTALLATION_ID="987654321" \
WEBHOOK_SECRET="verysecret" \
KEY_PATH="./github_key.pem" \
REGISTRY="ghcr.io//go-github-app"
```## Running
```bash
make container # Builds containerized application
make run # Runs container at localhost# From another terminal:
curl http://localhost:8080/api/v1/github/pullrequests/octocat/hello-world
```## Testing
Test are run inside container image, equivalent to the container in which the application runs. To run tests:
```bash
make testRunning tests:
? github.com/MartinHeinz/go-github-app/cmd/app [no test files]
ok github.com/MartinHeinz/go-github-app/cmd/app/apis 0.010s
? github.com/MartinHeinz/go-github-app/cmd/app/config [no test files]
? github.com/MartinHeinz/go-github-app/cmd/app/httputil [no test files]
? github.com/MartinHeinz/go-github-app/cmd/app/test_data [no test files]
? github.com/MartinHeinz/go-github-app/cmd/app/utils [no test files]
ok github.com/MartinHeinz/go-github-app/cmd/app/webhooks 0.006s
? github.com/MartinHeinz/go-github-app/pkg [no test files]Checking gofmt: PASS
Checking go vet: PASS
```## CI/CD
Predefined CI/CD uses GitHub Actions:
- _Build, Test, Lint_ Workflow (`build.yaml`):
- Builds binary and container image
- Runs tests and generates code coverage report
- Performs SonarCloud code analysis
- Sends coverage starts to CodeClimate- _Release_ Workflow (`release.yaml`, triggered on _tag_ creation):
- Builds container image
- Pushes the image to GitHub container registry