Categorygithub.com/utkuufuk/github-service
repository
0.2.0
Repository: https://github.com/utkuufuk/github-service.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

github-service

A simple service to query GitHub issues & pull requests.

Server Mode

Start the server:

go run ./cmd/server

List of Endpoints

GET <SERVER_URL>/entrello

Fetch self-assigned issues from personal repositories.

GET <SERVER_URL>/entrello/prlo

Fetch pull requests that meet all of the following conditions:

  • belongs to the configured organization
  • belongs to one of the configured subscribed repositories
  • neither created by nor assigned to the configured user
  • not draft

GET <SERVER_URL>/entrello/prlmy

Fetch pull requests that meet all of the following conditions:

  • belongs to the configured organization
  • created by the configured user

GET <SERVER_URL>/entrello/prlme

Fetch pull requests that meet all of the following conditions:

  • belongs to the configured organization
  • assigned to the configured user
  • not created by configured user

CLI Mode

The result set of each endpoint listed above can be alternatively retrieved using the corresponding CLI command.

List of Commands

go run ./cmd/cli
go run ./cmd/cli prlo
go run ./cmd/cli prlmy
go run ./cmd/cli prlme

Configuration

Put your environment variables in a file called .env, based on .env.example.

Environment VariableDescription
PERSONAL_ACCESS_TOKENGitHub personal access token
ORG_NAMEGitHub organization name (required for prlo, prlmy and prlme)
USER_NAMEGitHub user name (required for prlo and prlme)
SUBSCRIBED_REPOSSubscribed GitHub repositories (required for prlo)
PORTHTTP port (server mode only)
SECRETAPI secret (server mode only, optional)

Running With Docker

A new Docker image will be created upon each release.

  1. Authenticate with the GitHub container registry (only once):

    echo $GITHUB_ACCESS_TOKEN | docker login ghcr.io -u GITHUB_USERNAME --password-stdin
    
  2. Pull the latest Docker image:

    docker pull ghcr.io/utkuufuk/github-service/image:latest
    
  3. Start a container:

    # server
    docker run -d \
        -p <PORT>:<PORT> \
        --env-file </absolute/path/to/.env> \
        --restart unless-stopped \
        --name github-service \
        ghcr.io/utkuufuk/github-service/image:latest
    
    # CLI
    docker run --rm \
        --env-file </absolute/path/to/.env> \
        ghcr.io/utkuufuk/github-service/image:latest \
        ./cli