11 Commits
0.1 ... 0.1.1

Author SHA1 Message Date
Athul Cyriac Ajay
8ac60ed14f Merge pull request #4 from gautamkrishnar/patch-1
Added screenshot for better visisbility of the workflow fearure
2020-07-12 17:20:30 +05:30
Gautam krishna R
9ea8300262 Added screenshot 2020-07-12 15:55:48 +05:30
athul
702a9a9e8e Updated Readme on Getting Wakatime API Key 2020-07-12 13:14:51 +05:30
athul
c469bfb723 Readme Updates and Usages in Profile Repo 2020-07-11 12:42:03 +05:30
Athul Cyriac Ajay
6a5ebb1ab0 Merge pull request #3 from gautamkrishnar/patch-2
Updated code to do commit only if readme changed
2020-07-11 12:02:46 +05:30
Athul Cyriac Ajay
a37900c521 Merge pull request #2 from gautamkrishnar/patch-1
Added info about USERNAME in the readme
2020-07-10 18:00:51 +05:30
Gautam krishna R
8e15ddefda Updated code to do commit only if readme changed 2020-07-10 17:33:04 +05:30
Gautam krishna R
64fb92311d Added info about USERNAME in the readme 2020-07-10 16:10:44 +05:30
athul
66fb6bbc52 Changes Token name 2020-07-10 09:49:37 +05:30
athul
30417a50d4 Minor Changes 2020-07-10 09:43:21 +05:30
Athul Cyriac Ajay
cb9b2232a8 Add Push to Master as Job 2020-07-10 09:01:48 +05:30
5 changed files with 64 additions and 40 deletions

View File

@@ -1,24 +0,0 @@
# This is a basic workflow to help you get started with Actions
name: Waka Readme
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
schedule:
# Runs at 12am UTC
- cron: '0 0 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Update Readme
uses: athul/waka-readme@master
with:
WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }}

View File

@@ -2,6 +2,7 @@ FROM python:latest
# Install dependencies.
ADD requirements.txt /requirements.txt
ADD main.py /main.py
RUN pip install -r requirements.txt
CMD python main.py
CMD ["python", "/main.py"]

View File

@@ -1,6 +1,7 @@
# Dev Metrics in Readme
[Wakatime](https://wakatime.com) Weekly Metrics on your Profile Readme
[Wakatime](https://wakatime.com) Weekly Metrics on your Profile Readme:
![Project Preview](https://user-images.githubusercontent.com/8397274/87243943-e6b45c00-c457-11ea-94c9-2aa0bf241be8.png)
## Update your Readme
@@ -13,18 +14,62 @@ Add a comment to your README like the follows
The lines will be our entrypoints for our metrics.
## How to get it
## Using it
- Clone the Repo
- Install the dependencies `pip install -r requirements.txt`
- Get a GitHub Access Token with a `repo` scope.
- Get your Wakatime API Key.
- Load env vars like
```text
GH_TOKEN = <ghtoken>
WAKATIME_API_KEY = <your wakatime API Key>
USERNAME = <github_username>
```
- Get your Wakatime API Key from your [Account Settings in Wakatime](https://wakatime.com/settings/account) and save it as `WAKATIME_API_KEY = <your wakatime API Key>` in your Repository Secrets
- Run the Script with `python main.py`
That's it. The Action runs everyday at 00.00 UTC
### Profile Repository
If you're executing the workflow on your Profile Repository (`<username>/<username>`)
**You wouldn't need an GitHub Access Token since GitHub Actions already makes one for you.**
Here is a sample workflow file for you to get started,
```yml
name: Waka Readme
on:
schedule:
# Runs at 12am UTC
- cron: '0 0 * * *'
jobs:
update-readme:
name: Update this repo's README
runs-on: ubuntu-latest
steps:
- uses: athul/waka-readme@master
with:
WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }}
```
### Different Repository than Profile Repository
if you're executing the workflow on another repo other than `<username>/<username>`
- You'll need to get a GitHub Access Token with a `repo` scope and save it in the Repo Secrets `GH_TOKEN = <Your GitHub Access Token>`
Here is Sample Worflow File for running it
```yml
name: Waka Readme
on:
schedule:
# Runs at 12am UTC
- cron: '0 0 * * *'
jobs:
update-readme:
name: Update Readme with Metrics
runs-on: ubuntu-latest
steps:
- uses: athul/waka-readme@master
with:
WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }}
GH_TOKEN: ${{ secrets.GH_TOKEN}}
USERNAME: <username> # optional, it will automaticially use the username that executing the workflow
```

View File

@@ -5,6 +5,7 @@ description: 'Add a Wakatime Coding Activity graph in your Readme'
inputs:
GH_TOKEN:
description: 'GitHub access token with Repo scope'
required: true
default: ${{ github.token }}
WAKATIME_API_KEY:

View File

@@ -53,5 +53,6 @@ if __name__ == '__main__':
stats = getStats()
rdmd = decodeReadme(contents.content)
newreadme = generatenewReadme(stats=stats, readme=rdmd)
repo.update_file(path=contents.path, message="Updated with Dev Metrics",
if newreadme != rdmd:
repo.update_file(path=contents.path, message="Updated with Dev Metrics",
content=newreadme, sha=contents.sha, branch="master")