Skip to content

Commit 7eaf2c1

Browse files
testing..
1 parent ff2ab94 commit 7eaf2c1

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

β€Žaction.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ inputs:
1111
description: 'Your GitHub username'
1212
default: ${{ github.repository_owner }}
1313
required: false
14+
15+
PREMIUM:
16+
description: 'Premium User or Not'
17+
default: false
18+
required: false
1419

1520
runs:
1621
using: "node12"

β€Ždist/index.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,7 @@ const fs = __webpack_require__(747);
458458
const exec = __webpack_require__(898);
459459

460460
const TODOIST_API_KEY = core.getInput("TODOIST_API_KEY");
461+
const PREMIUM = core.getInput("PREMIUM");
461462

462463
async function main() {
463464
const stats = await axios(`https://api.todoist.com/sync/v8.3/completed/get_stats?token=${TODOIST_API_KEY}`);
@@ -471,21 +472,27 @@ const README_FILE_PATH = './README.md';
471472
async function updateReadme(data) {
472473

473474

474-
const { karma, completed_count, days_items, goals } = data;
475+
const { karma, completed_count, days_items, goals, week_items } = data;
475476

476-
const karmaPoint = [`πŸ† ${Humanize.intComma(karma)} Karma Points`];
477+
const karmaPoint = [`πŸ† ${Humanize.intComma(karma)} Karma Points`];
477478
todoist.push(karmaPoint);
478479

479480
const dailyGoal = [
480-
`🌸 Completed ${days_items[0].total_completed.toString()} tasks today`,
481+
`🌸 Completed ${days_items[0].total_completed.toString()} tasks today`,
481482
];
482483
todoist.push(dailyGoal);
483484

484-
const totalTasks = [`βœ… Completed ${Humanize.intComma(completed_count)} tasks so far`];
485+
const totalTasks = [`βœ… Completed ${Humanize.intComma(completed_count)} tasks so far`];
485486
todoist.push(totalTasks);
487+
488+
if(PREMIUM) {
489+
const weekItems = [`πŸ—“ Completed ${week_items[0].total_completed.toString()} tasks this week`];
490+
todoist.push(totalTasks);
491+
}
492+
486493

487494
const longestStreak = [
488-
`⏳ Longest streak is ${goals.max_daily_streak.count} days`,
495+
`⏳ Longest streak is ${goals.max_daily_streak.count} days`,
489496
];
490497
todoist.push(longestStreak);
491498

β€Žindex.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const fs = require("fs");
55
const exec = require("./exec");
66

77
const TODOIST_API_KEY = core.getInput("TODOIST_API_KEY");
8+
const PREMIUM = core.getInput("PREMIUM");
89

910
async function main() {
1011
const stats = await axios(`https://api.todoist.com/sync/v8.3/completed/get_stats?token=${TODOIST_API_KEY}`);
@@ -18,21 +19,27 @@ const README_FILE_PATH = './README.md';
1819
async function updateReadme(data) {
1920

2021

21-
const { karma, completed_count, days_items, goals } = data;
22+
const { karma, completed_count, days_items, goals, week_items } = data;
2223

23-
const karmaPoint = [`πŸ† ${Humanize.intComma(karma)} Karma Points`];
24+
const karmaPoint = [`πŸ† ${Humanize.intComma(karma)} Karma Points`];
2425
todoist.push(karmaPoint);
2526

2627
const dailyGoal = [
27-
`🌸 Completed ${days_items[0].total_completed.toString()} tasks today`,
28+
`🌸 Completed ${days_items[0].total_completed.toString()} tasks today`,
2829
];
2930
todoist.push(dailyGoal);
3031

31-
const totalTasks = [`βœ… Completed ${Humanize.intComma(completed_count)} tasks so far`];
32+
const totalTasks = [`βœ… Completed ${Humanize.intComma(completed_count)} tasks so far`];
3233
todoist.push(totalTasks);
34+
35+
if(PREMIUM) {
36+
const weekItems = [`πŸ—“ Completed ${week_items[0].total_completed.toString()} tasks this week`];
37+
todoist.push(totalTasks);
38+
}
39+
3340

3441
const longestStreak = [
35-
`⏳ Longest streak is ${goals.max_daily_streak.count} days`,
42+
`⏳ Longest streak is ${goals.max_daily_streak.count} days`,
3643
];
3744
todoist.push(longestStreak);
3845

0 commit comments

Comments
Β (0)