Skip to content

Commit

Permalink
add +active-users (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
idelvall authored Mar 8, 2023
1 parent 635a7da commit fa747c6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
9 changes: 9 additions & 0 deletions billing/Earthfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
VERSION 0.6

FROM alpine/git:2.36.3

# Estimates monthly active users of a GIT remote repo, based on past commits
active-users:
RUN --secret repoUrl git clone --bare --filter=blob:none $repoUrl repo;
RUN cd repo; \
git --no-pager log -s --format="%ae" --since=30.days | grep -v @users.noreply.github.com | sort | uniq -c | awk '$1 >= 3 {print $0}' | wc -l
16 changes: 16 additions & 0 deletions billing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Billing utilities
## +active-users
Estimates monthly active users of a GIT remote repo, based on past commits

Usage:
```
earthly --secret repoUrl=<repoUrl> github.com/earthly/lib/billing+active-users
```

### Private repositories
For private repositories use `https` URLs, and pass credentials within the URL:
```
earthly --secret repoUrl=https://<user>@<password>/host/repo.git github.com/earthly/lib/billing+active-users
```
> Note:
> For GitHub private repos you need to use a [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) instead of your password

0 comments on commit fa747c6

Please sign in to comment.