Skip to content

Commit

Permalink
rename to utils & wkr-gh-sponsor->mass-gh-sponsor
Browse files Browse the repository at this point in the history
  • Loading branch information
nehzata committed Sep 27, 2023
1 parent 172193f commit c0ae0d9
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 37 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ SHELL ["/bin/bash", "-c"]
RUN GIT_COMMIT=$(git rev-parse --short HEAD) && \
CGO_ENABLED=1 GOOS=linux ./bin/go build \
-ldflags "-X main.GitCommit=$GIT_COMMIT" \
-o /app/wkr-gh-sponsor ./cmd/wkr-gh-sponsor
-o /app/mass-gh-sponsor ./cmd/mass-gh-sponsor

FROM ubuntu as runtime
RUN apt update && \
apt install -y ca-certificates && \
rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/wkr-gh-sponsor /app/wkr-gh-sponsor
COPY --from=builder /app/mass-gh-sponsor /app/mass-gh-sponsor
WORKDIR /app
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# wkr-gh-sponsor
# mass-gh-sponsor

This project is a standalone worker that continuosly:
- Checks https://api.thanks.dev/v1/deps to obtain the latest list of dependencies;
Expand All @@ -7,8 +7,8 @@ This project is a standalone worker that continuosly:

### Command line flags
```
wkr-gh-sponsor git:(master) ./scripts/wkr-gh-sponsor --help
Usage: wkr-gh-sponsor --db-path="db.sql" --gh-classic-access-token=GH-ACCESS-TOKEN --entities=ENTITIES,...
mass-gh-sponsor git:(master) ./scripts/mass-gh-sponsor --help
Usage: mass-gh-sponsor --db-path="db.sql" --gh-classic-access-token=GH-ACCESS-TOKEN --entities=ENTITIES,...
Flags:
-h, --help Show context-sensitive help.
Expand Down Expand Up @@ -40,19 +40,19 @@ wkr-repos

### Run locally
`. bin/activate-hermit`
`GH_CLASSIC_ACCESS_TOKEN=<TOKEN> ./scripts/wkr-gh-sponsor --config example.config.json`
`GH_CLASSIC_ACCESS_TOKEN=<TOKEN> ./scripts/mass-gh-sponsor --config example.config.json`

### Docker & docker compose
A sample docker-compose.yml is provided to run this project.
```
cp example.env .env # update the latest api keys & access tokens
cp example.config.json config.json # insert the github slugs of the user accounts / orgs
docker compose --env-file .env up -d wkr-gh-sponsor
docker compose --env-file .env up -d mass-gh-sponsor
```

### GH-ACCESS-TOKEN
Ensure you create a classic GH access token with `admin:org` and `user` scopes configured. Set a custom expiration date to one day after the last expected donation date.
![image](https://github.com/thnxdev/wkr-gh-sponsor/assets/72539235/69f248a8-2351-471e-84d5-43eeba9d3f5f)
![image](https://github.com/thnxdev/utils/assets/72539235/69f248a8-2351-471e-84d5-43eeba9d3f5f)

**Ensure you keep the token stored securely**
Unfortunately, these are the minimum scopes that can create a sponsorship via the GH GraphQL API and they contain write permissions on your account.
Expand Down
18 changes: 9 additions & 9 deletions cmd/wkr-gh-sponsor/main.go → cmd/mass-gh-sponsor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ import (
"github.com/sirupsen/logrus"
"golang.org/x/sync/errgroup"

wkrghsponsor "github.com/thnxdev/wkr-gh-sponsor"
"github.com/thnxdev/wkr-gh-sponsor/database"
"github.com/thnxdev/wkr-gh-sponsor/utils/config"
"github.com/thnxdev/wkr-gh-sponsor/utils/log"
"github.com/thnxdev/wkr-gh-sponsor/workers"

_ "github.com/thnxdev/wkr-gh-sponsor/workers/wkr-donate"
_ "github.com/thnxdev/wkr-gh-sponsor/workers/wkr-entities"
_ "github.com/thnxdev/wkr-gh-sponsor/workers/wkr-repos"
wkrghsponsor "github.com/thnxdev/utils"
"github.com/thnxdev/utils/database"
"github.com/thnxdev/utils/utils/config"
"github.com/thnxdev/utils/utils/log"
"github.com/thnxdev/utils/workers"

_ "github.com/thnxdev/utils/workers/wkr-donate"
_ "github.com/thnxdev/utils/workers/wkr-entities"
_ "github.com/thnxdev/utils/workers/wkr-repos"
)

// Populated during build.
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
services:
wkr-gh-sponsor:
container_name: wkr-gh-sponsor
mass-gh-sponsor:
container_name: mass-gh-sponsor
build:
context: .
dockerfile: Dockerfile
volumes:
- type: bind
source: /tmp/wkr-gh-sponsor.sql
source: /tmp/mass-gh-sponsor.sql
target: /app/db.sql
- type: bind
source: /tmp/wkr-gh-sponsor.json
source: /tmp/mass-gh-sponsor.json
target: /app/config.json
command: /app/wkr-gh-sponsor --config config.json
command: /app/mass-gh-sponsor --config config.json
working_dir: /app
environment:
DB_PATH: /app/db.sql
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/thnxdev/wkr-gh-sponsor
module github.com/thnxdev/utils

go 1.20

Expand Down
2 changes: 1 addition & 1 deletion reflex.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Run the service, reloading when any .go files change.
-sr '\.go$' -- \
wkr-gh-sponsor --config config.json
mass-gh-sponsor --config config.json

# Run "go generate" when any .go files change.
-r '\.go$' -R '_enumer\.go$' -R 'service_api.go$' -- \
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions workers/wkr-donate/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import (

"github.com/alecthomas/errors"
"github.com/shurcooL/githubv4"
wkrghsponsor "github.com/thnxdev/wkr-gh-sponsor"
"github.com/thnxdev/wkr-gh-sponsor/database"
"github.com/thnxdev/wkr-gh-sponsor/utils/log"
"github.com/thnxdev/wkr-gh-sponsor/workers"
wkrghsponsor "github.com/thnxdev/utils"
"github.com/thnxdev/utils/database"
"github.com/thnxdev/utils/utils/log"
"github.com/thnxdev/utils/workers"
"golang.org/x/oauth2"
)

Expand Down
6 changes: 3 additions & 3 deletions workers/wkr-entities/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (

"github.com/alecthomas/errors"
"github.com/google/go-github/v55/github"
wkrghsponsor "github.com/thnxdev/wkr-gh-sponsor"
"github.com/thnxdev/wkr-gh-sponsor/database"
"github.com/thnxdev/wkr-gh-sponsor/workers"
wkrghsponsor "github.com/thnxdev/utils"
"github.com/thnxdev/utils/database"
"github.com/thnxdev/utils/workers"
)

func init() {
Expand Down
10 changes: 5 additions & 5 deletions workers/wkr-repos/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import (

"github.com/alecthomas/errors"
"github.com/shurcooL/githubv4"
wkrghsponsor "github.com/thnxdev/wkr-gh-sponsor"
"github.com/thnxdev/wkr-gh-sponsor/database"
"github.com/thnxdev/wkr-gh-sponsor/utils/httpgh"
"github.com/thnxdev/wkr-gh-sponsor/utils/log"
"github.com/thnxdev/wkr-gh-sponsor/workers"
wkrghsponsor "github.com/thnxdev/utils"
"github.com/thnxdev/utils/database"
"github.com/thnxdev/utils/utils/httpgh"
"github.com/thnxdev/utils/utils/log"
"github.com/thnxdev/utils/workers"
"golang.org/x/oauth2"
)

Expand Down
2 changes: 1 addition & 1 deletion workers/workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/alecthomas/errors"
"github.com/alecthomas/kong"
"github.com/jpillora/backoff"
"github.com/thnxdev/wkr-gh-sponsor/utils/log"
"github.com/thnxdev/utils/utils/log"
"golang.org/x/sync/errgroup"
)

Expand Down

0 comments on commit c0ae0d9

Please sign in to comment.