-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
75 lines (68 loc) · 2.14 KB
/
action.yml
File metadata and controls
75 lines (68 loc) · 2.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: "Waka README Daily Stats"
description: "Update README daily coding stats using WakaTime summaries"
author: "pphatdev"
branding:
icon: "activity"
color: "green"
inputs:
waka-token:
description: "WakaTime API token"
required: true
github-token:
description: "GitHub token used by your script when needed"
required: false
default: ""
waka-api:
description: "WakaTime API base URL"
required: false
default: "https://wakatime.com/api/v1"
bar-style:
description: "Progress bar style (block, shade, ascii, dot, pipe, emoji)"
required: false
default: "block"
python-version:
description: "Python version"
required: false
default: "3.12"
entrypoint:
description: "Python entrypoint path"
required: false
default: "src/main.py"
outputs:
changed:
description: "Whether README/data files changed after running"
value: ${{ steps.detect.outputs.changed }}
runs:
using: "composite"
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r ${{ github.action_path }}/requirements.txt
- name: Create runtime .env for script
shell: bash
run: |
cp ${{ github.action_path }}/.env.example .env
printf "\nWAKA_API=%s\n" "${{ inputs.waka-api }}" >> .env
printf "WAKA_TOKEN=%s\n" "${{ inputs.waka-token }}" >> .env
printf "BAR_STYLE=%s\n" "${{ inputs.bar-style }}" >> .env
if [ -n "${{ inputs.github-token }}" ]; then
printf "GITHUB_TOKEN=%s\n" "${{ inputs.github-token }}" >> .env
fi
- name: Run updater
shell: bash
run: python ${{ inputs.entrypoint }}
- name: Detect file changes
id: detect
shell: bash
run: |
if git diff --quiet -- README.md data/coding_stats.json; then
echo "changed=false" >> "$GITHUB_OUTPUT"
else
echo "changed=true" >> "$GITHUB_OUTPUT"
fi