GitHub Action
CodeTime - Readme
Display your CodeTime stats on your Profile Readme:
To incorporate CodeTime stats in your README, add the following comment:
<!--START_SECTION:codetime-->
<!--END_SECTION:codetime-->
These lines will serve as entry points for this action.
To use CodeTime Stats in your README, you need to obtain a cookie token from CodeTime and add it to your repository secrets. Follow these steps:
- Visit the CodeTime website and log in to your account.
- Open the developer tools in your browser (usually by right-clicking on the page and selecting
Inspect
orInspect Element
). - Navigate to the
Network
tab in the developer tools. - Refresh the page to view the network requests.
- Find a request named
top?field=platform&minutes...
and select it. - In the request details, navigate to the
Headers
section. - Locate the cookie and copy everything after CODETIME_SESSION=. For example, if you see
CODETIME_SESSION=MASDkhiagbdyhoi21d89y21bndsgaDPADHoiha98yd9qw=
,MASDkhiagbdyhoi21d89y21bndsgaDPADHoiha98yd9qw=
is the token.
After obtaining the cookie token, add it to your repository secrets:
- Navigate to your repository on GitHub.
- Select the
Settings
tab. - In the left sidebar, click on
Secrets and variables
andActions
. - Click on
New repository secret
. - Provide a name for the secret (e.g.,
CODETIME_COOKIE_KEY
) and paste the cookie token value in theValue
field. - Click on
Add secret
to save it.
The Action runs every 6 hours on UTC.
No need for a GitHub Access Token as GitHub Actions already provides one for you.
Here's a sample workflow file to get you started:
name: CodeTime - Readme
on:
schedule:
- cron: "0 */6 * * *"
jobs:
update-readme:
name: CodeTime's Graph in Readme
runs-on: ubuntu-latest
steps:
- uses: xafec/[email protected]
with:
CODETIME_COOKIE_KEY: ${{ secrets.CODETIME_COOKIE_KEY }}
Contributions to this project are welcome. Any form of help is greatly appreciated ❤️
Note: I'm not particularly proficient in Python and Docker, so if you find this project interesting, feel free to develop it further. This project was created based on the waka-readme version 0.1.