forked from mirrored/github-readme-stats
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8ee4eed743 |
@@ -1,35 +0,0 @@
|
||||
name: Push Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'develop'
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
tags: |
|
||||
${{ vars.DOCKERHUB_TARGET }}:develop
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
name: Push Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '[0-9.]+-[0-9]+-[0-9]+'
|
||||
# for this project, we do "YYYY-MM-DD" for version numbers, due to unversioned upstream
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile
|
||||
push: true
|
||||
platforms: linux/amd64
|
||||
tags: |
|
||||
${{ vars.DOCKERHUB_TARGET }}:latest
|
||||
${{ vars.DOCKERHUB_TARGET }}:${{ github.ref_name }}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
name: Sync GitHub
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --global user.name "Andrew Sync"
|
||||
git config --global user.email "sync@digitaladapt.com"
|
||||
|
||||
- name: Add GitHub Remote
|
||||
env:
|
||||
SYNC_TOKEN: ${{ secrets.SYNC_GITHUB_TOKEN }}
|
||||
SYNC_TARGET: ${{ vars.SYNC_GITHUB_TARGET }}
|
||||
run: |
|
||||
git remote add github "https://digitaladapt:${SYNC_TOKEN}@github.com/$SYNC_TARGET"
|
||||
|
||||
- name: Push Current Branch
|
||||
run: |
|
||||
git push github HEAD:${GITHUB_REF_NAME}
|
||||
|
||||
- name: Push Tags
|
||||
run: |
|
||||
git push github --tags
|
||||
|
||||
@@ -13,7 +13,7 @@ jobs:
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- name: Deployment Prep
|
||||
run: python ./.github/workflows/deploy-prep.py
|
||||
- uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3 # v7.0.0
|
||||
- uses: stefanzweifel/git-auto-commit-action@04702edda442b2e678b25b537cec683a1493fcb9 # v7.1.0
|
||||
with:
|
||||
branch: vercel
|
||||
create_branch: true
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
[Caddyfile]
|
||||
indent_style = tab
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
readme-stats.example.com {
|
||||
## optional, force all requests to return your github stats
|
||||
#uri query username ${github_username:anuraghazra}
|
||||
reverse_proxy readme_stats:${port:9000}
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
FROM node:lts-alpine
|
||||
|
||||
# environment variables
|
||||
ENV port=9000
|
||||
ENV github_username=anuraghazra
|
||||
|
||||
# setup folder within the docker container with this app's files
|
||||
WORKDIR /app
|
||||
COPY ./api /app/api
|
||||
COPY ./scripts /app/scripts
|
||||
COPY ./src /app/src
|
||||
COPY ./themes /app/themes
|
||||
COPY ./express.js /app/express.js
|
||||
COPY ./package.json /app/package.json
|
||||
COPY ./package-lock.json /app/package-lock.json
|
||||
|
||||
# prepare script uses a dev-dependency, so remove it,
|
||||
# move express from dev-dependency to regular dependency
|
||||
# then finally install all non-dev dependencies
|
||||
RUN npm pkg delete scripts.prepare \
|
||||
&& npm pkg set dependencies.express="$(node -p "require('./package.json').devDependencies.express")" \
|
||||
&& npm pkg delete devDependencies.express \
|
||||
&& npm ci --omit=dev
|
||||
|
||||
# healthcheck
|
||||
HEALTHCHECK --interval=60m \
|
||||
--retries=3 \
|
||||
--start-interval=1s \
|
||||
--start-period=10s \
|
||||
--timeout=5s \
|
||||
CMD wget --no-verbose -O - --tries=1 "http://127.0.0.1:$port/api/?username=$github_username" | grep 'GitHub Stats' || exit 1
|
||||
|
||||
# start the app, on the supplied port
|
||||
EXPOSE $port
|
||||
CMD [ "node", "express.js" ]
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
services:
|
||||
readme_stats:
|
||||
container_name: readme_stats
|
||||
env_file:
|
||||
- .env
|
||||
expose:
|
||||
- $port
|
||||
init: true
|
||||
image: digitaladapt/github-readme-stats:latest
|
||||
restart: unless-stopped
|
||||
|
||||
caddy:
|
||||
## optional, make caddy wait until the service is ready
|
||||
#depends_on:
|
||||
# readme_stats:
|
||||
# condition: service_healthy
|
||||
## optional, make variables in .env file available to use in your Caddyfile
|
||||
#env_file:
|
||||
# - .env
|
||||
image: caddy:lates
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "443:443/udp"
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
Get dynamically generated GitHub stats on your READMEs, with the ease of docker!
|
||||
|
||||
Fork of [https://github.com/anuraghazra/github-readme-stats](https://github.com/anuraghazra/github-readme-stats), gently wrapped in docker.
|
||||
|
||||
Now as an image on Docker Hub.
|
||||
|
||||
**Steps to setup:**
|
||||
* add the readme_stats service to your existing docker-compose.yml.
|
||||
* configure your .env to have `PAT_1=<YOUR_GITHUB_TOKEN>`.
|
||||
* optionally configure `port`, and `github_username`
|
||||
* update your existing Caddyfile.
|
||||
* and start with `docker compose up -d`.
|
||||
|
||||
docker-compose.yml.example, Caddyfile.example, and env.example have a very simple working example using Caddy reverse proxy.
|
||||
|
||||
Files have example in their name, so that when you update, your local settings won't be overridden.
|
||||
|
||||
```
|
||||
git clone https://code.digitaladapt.com/andrew/github-readme-stats.git
|
||||
cd github-readme-stats
|
||||
cp docker-compose.yml.example docker-compose.yml
|
||||
cp env.example .env
|
||||
vim .env
|
||||
# add your github token
|
||||
|
||||
cp Caddyfile.example Caddyfile
|
||||
vim Caddyfile
|
||||
# configure your domain
|
||||
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
+1
-9
@@ -18,14 +18,6 @@ router.get("/gist", gistCard);
|
||||
app.use("/api", router);
|
||||
|
||||
const port = process.env.PORT || process.env.port || 9000;
|
||||
const server = app.listen(port, "0.0.0.0", () => {
|
||||
app.listen(port, "0.0.0.0", () => {
|
||||
console.log(`Server running on port ${port}`);
|
||||
});
|
||||
|
||||
/* stop gracefully when requested */
|
||||
process.on("SIGTERM", () => {
|
||||
console.log("stopping, received SIGTERM signal");
|
||||
server.close(() => {
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
|
||||
@@ -85,13 +85,13 @@
|
||||
- [Stats and top languages cards](#stats-and-top-languages-cards)
|
||||
- [Pinning repositories](#pinning-repositories)
|
||||
- [Deploy on your own](#deploy-on-your-own)
|
||||
- [GitHub Actions (Recommended)](#github-actions-recommended)
|
||||
- [Self-hosted (Vercel/Other) (Recommended)](#self-hosted-vercelother-recommended)
|
||||
- [First step: get your Personal Access Token (PAT)](#first-step-get-your-personal-access-token-pat)
|
||||
- [On Vercel](#on-vercel)
|
||||
- [First step: get your Personal Access Token (PAT)](#first-step-get-your-personal-access-token-pat)
|
||||
- [Classic token](#classic-token)
|
||||
- [Fine-grained token](#fine-grained-token)
|
||||
- [On Vercel](#on-vercel)
|
||||
- [:film\_projector: Check Out Step By Step Video Tutorial By @codeSTACKr](#film_projector-check-out-step-by-step-video-tutorial-by-codestackr)
|
||||
- [On other platforms](#on-other-platforms)
|
||||
- [Available environment variables](#available-environment-variables)
|
||||
- [On other platforms](#on-other-platforms)
|
||||
- [Available environment variables](#available-environment-variables)
|
||||
- [Keep your fork up to date](#keep-your-fork-up-to-date)
|
||||
- [:sparkling\_heart: Support the project](#sparkling_heart-support-the-project)
|
||||
</details>
|
||||
@@ -99,7 +99,7 @@
|
||||
# Important Notices <!-- omit in toc -->
|
||||
|
||||
> [!IMPORTANT]
|
||||
> The public Vercel instance at `https://github-readme-stats.vercel.app/api` is best-effort and can be unreliable due to rate limits and traffic spikes (see [#1471](https://github.com/anuraghazra/github-readme-stats/issues/1471)). We use caching to improve stability (see [common options](#common-options)), but for reliable cards we recommend [self-hosting](#deploy-on-your-own) (Vercel or other) or using the [GitHub Actions workflow](#github-actions-recommended) to generate cards in your [profile repository](https://docs.github.com/en/account-and-profile/how-tos/profile-customization/managing-your-profile-readme).
|
||||
> Since the GitHub API only [allows 5k requests per hour per user account](https://docs.github.com/en/graphql/overview/resource-limitations), the public Vercel instance hosted on `https://github-readme-stats.vercel.app/api` could possibly hit the rate limiter (see [#1471](https://github.com/anuraghazra/github-readme-stats/issues/1471)). We use caching to prevent this from happening (see https://github.com/anuraghazra/github-readme-stats#common-options). You can turn off these rate limit protections by [deploying your own Vercel instance](#deploy-on-your-own).
|
||||
|
||||
<img alt="Uptime Badge" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fgithub-readme-stats-git-monitoring-github-readme-stats-team.vercel.app%2Fapi%2Fstatus%2Fup%3Ftype%3Dshields">
|
||||
|
||||
@@ -796,66 +796,15 @@ By default, GitHub does not lay out the cards side by side. To do that, you can
|
||||
|
||||
</details>
|
||||
|
||||
# Deploy on your own (recommended)
|
||||
# Deploy on your own
|
||||
|
||||
Because the public endpoint is [not reliable](#Important-Notices), we recommend self-deployment via GitHub Actions or your own hosted instance. GitHub Actions is the simplest setup with static SVGs stored in your repo but less frequent updates, while self-hosting takes more work and can serve fresher stats (with caching).
|
||||
|
||||
## GitHub Actions
|
||||
|
||||
GitHub Actions generates static SVGs and avoids per-request API calls. By default it uses `GITHUB_TOKEN` (public stats only), for private stats, set a [PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) as a secret and pass it to the action instead.
|
||||
|
||||
Create `/.github/workflows/grs.yml` in your profile repo (`USERNAME/USERNAME`):
|
||||
|
||||
```yaml
|
||||
name: Update README cards
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 3 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Generate stats card
|
||||
uses: readme-tools/github-readme-stats-action@v1
|
||||
with:
|
||||
card: stats
|
||||
options: username=${{ github.repository_owner }}&show_icons=true
|
||||
path: profile/stats.svg
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Commit cards
|
||||
run: |
|
||||
git config user.name "github-actions"
|
||||
git config user.email "github-actions@users.noreply.github.com"
|
||||
git add profile/*.svg
|
||||
git commit -m "Update README cards" || exit 0
|
||||
git push
|
||||
```
|
||||
|
||||
Then embed from your profile README:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
See more options and examples in the [GitHub Readme Stats Action README](https://github.com/readme-tools/github-readme-stats-action#readme).
|
||||
|
||||
## Self-hosted (Vercel/Other)
|
||||
|
||||
Running your own instance avoids public rate limits and gives you full control over caching, tokens, and private stats.
|
||||
|
||||
### First step: get your Personal Access Token (PAT)
|
||||
## First step: get your Personal Access Token (PAT)
|
||||
|
||||
For deploying your own instance of GitHub Readme Stats, you will need to create a GitHub Personal Access Token (PAT). Below are the steps to create one and the scopes you need to select for both classic and fine-grained tokens.
|
||||
|
||||
Selecting the right scopes for your token is important in case you want to display private contributions on your cards.
|
||||
|
||||
#### Classic token
|
||||
### Classic token
|
||||
|
||||
* Go to [Account -> Settings -> Developer Settings -> Personal access tokens -> Tokens (classic)](https://github.com/settings/tokens).
|
||||
* Click on `Generate new token -> Generate new token (classic)`.
|
||||
@@ -864,7 +813,7 @@ Selecting the right scopes for your token is important in case you want to displ
|
||||
* read:user
|
||||
* Click on `Generate token` and copy it.
|
||||
|
||||
#### Fine-grained token
|
||||
### Fine-grained token
|
||||
|
||||
> [!WARNING]\
|
||||
> This limits the scope to issues in your repositories and includes only public commits.
|
||||
@@ -881,7 +830,7 @@ Selecting the right scopes for your token is important in case you want to displ
|
||||
* Pull requests: read-only
|
||||
* Click on `Generate token` and copy it.
|
||||
|
||||
### On Vercel
|
||||
## On Vercel
|
||||
|
||||
### :film\_projector: [Check Out Step By Step Video Tutorial By @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
@@ -917,7 +866,7 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme
|
||||
|
||||
</details>
|
||||
|
||||
### On other platforms
|
||||
## On other platforms
|
||||
|
||||
> [!WARNING]
|
||||
> This way of using GRS is not officially supported and was added to cater to some particular use cases where Vercel could not be used (e.g. [#2341](https://github.com/anuraghazra/github-readme-stats/discussions/2341)). The support for this method, therefore, is limited.
|
||||
@@ -934,7 +883,7 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme
|
||||
5. You're done 🎉
|
||||
</details>
|
||||
|
||||
### Available environment variables
|
||||
## Available environment variables
|
||||
|
||||
GitHub Readme Stats provides several environment variables that can be used to customize the behavior of your self-hosted instance. These include:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user