update action
This commit is contained in:
parent
53c107f15d
commit
327be5ad89
2 changed files with 29 additions and 17 deletions
24
action.ts
24
action.ts
|
@ -14,11 +14,14 @@ import {
|
|||
|
||||
async function main() {
|
||||
try {
|
||||
const username = "domai-tb"; //core.getInput("username");
|
||||
const username = core.getInput("username");
|
||||
|
||||
// Fetch Code::Stats API
|
||||
const profile = await fetchProfile(username);
|
||||
const toplang = await fetchTopLanguages(username);
|
||||
const history = await fetchHistory(username, 32);
|
||||
|
||||
// Generate Profile Summary Card
|
||||
const profilecard = ReactDOMServer.renderToStaticMarkup(
|
||||
new ProfileCard(profile.username, profile.xp, profile.recentXp, {
|
||||
hide: parseArray(core.getInput("hide")),
|
||||
|
@ -35,11 +38,18 @@ async function main() {
|
|||
}).render()
|
||||
);
|
||||
|
||||
console.log(`Generated ./codestats_profilecard_${username}.svg`);
|
||||
fs.writeFileSync(`./codestats_profilecard_${username}.svg`, profilecard);
|
||||
|
||||
// Generate Top Languages Card
|
||||
const toplangcard = ReactDOMServer.renderToStaticMarkup(
|
||||
new TopLanguagesCard(username, toplang.langs, {
|
||||
hide: parseArray(core.getInput("hide")),
|
||||
language_count: 21, // parseNumber(core.getInput("language_count")),
|
||||
card_width: clampValue(parseNumber(core.getInput("card_width")) || 300, 500),
|
||||
card_width: clampValue(
|
||||
parseNumber(core.getInput("card_width")) || 300,
|
||||
500
|
||||
),
|
||||
layout: "compact", // core.getInput("layout")
|
||||
title: `Code::Stats of ${username}`, // core.getInput("title"),
|
||||
title_color: core.getInput("title_color"),
|
||||
|
@ -50,6 +60,10 @@ async function main() {
|
|||
}).render()
|
||||
);
|
||||
|
||||
console.log(`Generated ./codestats_toplangs_${username}.svg`);
|
||||
fs.writeFileSync(`./codestats_toplangs_${username}.svg`, toplangcard);
|
||||
|
||||
// Generate History Card
|
||||
const historycard = ReactDOMServer.renderToStaticMarkup(
|
||||
new HistoryCard(username, history, {
|
||||
hide: parseArray(core.getInput("hide")),
|
||||
|
@ -67,13 +81,11 @@ async function main() {
|
|||
}).render()
|
||||
);
|
||||
|
||||
fs.writeFileSync(`./codestats_profilecard_${username}.svg`, profilecard);
|
||||
fs.writeFileSync(`./codestats_toplangs_${username}.svg`, toplangcard);
|
||||
console.log(`Generated ./codestats_history_${username}.svg`);
|
||||
fs.writeFileSync(`./codestats_history_${username}.svg`, historycard);
|
||||
|
||||
} catch (error) {
|
||||
//core.setFailed(error.message);
|
||||
console.log(error);
|
||||
//core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
22
action.yml
22
action.yml
|
@ -1,13 +1,13 @@
|
|||
name: 'Hello World'
|
||||
description: 'Greet someone and record the time'
|
||||
inputs:
|
||||
who-to-greet: # id of input
|
||||
description: 'Who to greet'
|
||||
required: true
|
||||
default: 'World'
|
||||
outputs:
|
||||
time: # id of output
|
||||
description: 'The time we greeted you'
|
||||
name: Code::Stats Profile Cards
|
||||
author: domai-tb
|
||||
description: An infographics generator to display stats about your Code::Stats account!
|
||||
|
||||
runs:
|
||||
using: 'node18'
|
||||
using: 'node20'
|
||||
main: 'action.ts'
|
||||
|
||||
inputs:
|
||||
username:
|
||||
description: Code::Sats account username
|
||||
required: true
|
||||
default: domai-tb
|
||||
|
|
Loading…
Add table
Reference in a new issue