Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/joedf/github-badge-2
simpler fork of github-badge
https://github.com/joedf/github-badge-2
badge github webapp widget
Last synced: about 3 hours ago
JSON representation
simpler fork of github-badge
- Host: GitHub
- URL: https://github.com/joedf/github-badge-2
- Owner: joedf
- License: mpl-2.0
- Created: 2020-07-22T04:48:20.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-30T01:16:13.000Z (9 days ago)
- Last Synced: 2024-10-30T03:53:45.344Z (9 days ago)
- Topics: badge, github, webapp, widget
- Language: Python
- Homepage:
- Size: 87.9 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# github-badge-2
Simpler implementation, utilizing GitHub's GraphQL API, and fork of:
https://github.com/berkerpeksag/github-badge## Setup
### Option 1 - Self-Hosted
Simply update `config.json` with your username and github api_key that has user repo read access and user activity. Run the `generate_badge.py` script with python v3.4+, with `jinja2` and `requests` installed.Then, set up a cron job or whatever you can use for a recurring / scheduled tasks to run the script periodically (something like every 24hrs) to update the generated `badge.html`. Or you can setup a free jinja webapp like on [pythonanywhere.com](https://pythonanywhere.com/) and simply check if the generated html exists or if modified date of the html file is greater than 1 day, see [example script](https://gist.github.com/joedf/84279ff7647d554a9d15f280a209c6b7).
Remember to set permissions to deny requests all files other than the generated html file.
### Option 2 - GitHub Actions & Pages
For GitHub Actions with GitHub Pages, see [update-badge-html.yml](.github/workflows/update-badge-html.yml) for example usage. You will need to add a GitHub token as `GH_BADGE_TOKEN` in the repository secrets. You will also need to set the GitHub Pages repository setting to use the `gh-pages` branch. You will likely want to add repositories with automated commits to main/default branches in `ignore_repos` in `config.json` to prevent said automated commits from being considered. Otherwise, the latest commit for those repositories may be considered the last automated commit (depending on your configuration) and not any commit by the actual user. So, the recent changes link presented in the widget may be point to potentially unwanted said commits.## Usage
You can then include the widget with the following code in similar form to:
```html```
## Dark theme / Night mode
You can use the dark theme by specifying `class="dark"` on `` in the html template. Or you can add `?theme=dark` to the end of the URL used for the `iframe`.## Preview
![Light theme](preview.png) ![Dark theme](preview.dark.png)