Version 2.10 (#30)
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
const __src = path.join(__dirname, "src")
|
||||
const __plugins = path.join(__src, "plugins")
|
||||
const __templates = path.join(__src, "templates")
|
||||
const __queries = path.join(__src, "queries")
|
||||
process.on("unhandledRejection", error => { throw error })
|
||||
colors.enable()
|
||||
|
||||
@@ -70,7 +71,7 @@
|
||||
return [`with:`, ...Object.entries({
|
||||
token:"${{ secrets.METRICS_TOKEN }}",
|
||||
dryrun:true,
|
||||
repositories:1,
|
||||
repositories:0,
|
||||
template:"${{ matrix.template }}",
|
||||
base:"",
|
||||
plugins_errors_fatal:true,
|
||||
@@ -109,26 +110,37 @@
|
||||
console.log(`Generated action`.grey)
|
||||
|
||||
//Perform assets includes
|
||||
const assets = {}
|
||||
const templates = (await fs.promises.readdir(__templates)).filter(name => !/.*[.]mjs$/.test(name)).sort()
|
||||
for (const name of templates) {
|
||||
const files = [
|
||||
`${__templates}/${name}/query.graphql`,
|
||||
`${__templates}/${name}/image.svg`,
|
||||
`${__templates}/${name}/style.css`,
|
||||
`${__templates}/${name}/fonts.css`,
|
||||
]
|
||||
const [query, image, style, fonts] = await Promise.all(files.map(async file => `${await fs.promises.readFile(path.resolve(file))}`))
|
||||
assets[name] = {query, image, style, fonts}
|
||||
console.log(`Prepared template ${name}`.grey)
|
||||
{
|
||||
const assets = {}
|
||||
const templates = (await fs.promises.readdir(__templates)).filter(name => !/.*[.]mjs$/.test(name)).sort()
|
||||
for (const name of templates) {
|
||||
const files = [
|
||||
`${__templates}/${name}/image.svg`,
|
||||
`${__templates}/${name}/style.css`,
|
||||
`${__templates}/${name}/fonts.css`,
|
||||
].map(file => fs.existsSync(path.resolve(file)) ? file : file.replace(`${__templates}/${name}/`, `${__templates}/classic/`))
|
||||
const [image, style, fonts] = await Promise.all(files.map(async file => `${await fs.promises.readFile(path.resolve(file))}`))
|
||||
assets[name] = {image, style, fonts}
|
||||
console.log(`Prepared template ${name}`.grey)
|
||||
}
|
||||
code = code.replace(/<#assets>/g, Buffer.from(JSON.stringify(assets)).toString("base64"))
|
||||
console.log(`Included ${templates.length} templates to generated action`.grey)
|
||||
}
|
||||
|
||||
//Perform queries includes
|
||||
{
|
||||
const assets = {}
|
||||
const queries = (await fs.promises.readdir(__queries)).sort()
|
||||
code = code.replace(/<#queries>/g, Buffer.from(JSON.stringify(assets)).toString("base64"))
|
||||
console.log(`Included ${queries.length} queries to generated action`.grey)
|
||||
}
|
||||
code = code.replace(/<#assets>/g, Buffer.from(JSON.stringify(assets)).toString("base64"))
|
||||
console.log(`Included ${templates.length} templates to generated action`.grey)
|
||||
|
||||
//Perform version include
|
||||
const version = JSON.parse(await fs.promises.readFile(path.join(__dirname, "package.json"))).version
|
||||
code = code.replace(/<#version>/g, version)
|
||||
console.log(`Included version number (${version}) to generated action`.grey)
|
||||
{
|
||||
const version = JSON.parse(await fs.promises.readFile(path.join(__dirname, "package.json"))).version
|
||||
code = code.replace(/<#version>/g, version)
|
||||
console.log(`Included version number (${version}) to generated action`.grey)
|
||||
}
|
||||
|
||||
//Minify
|
||||
code = minify(code).code
|
||||
|
||||
@@ -59,14 +59,8 @@ jobs:
|
||||
<%- testcase({
|
||||
plugin_pagespeed: true,
|
||||
plugin_pagespeed_token: "${{ secrets.PAGESPEED_TOKEN }}",
|
||||
}) %>
|
||||
|
||||
- name: ${{ matrix.template }} > Plugin > PageSpeed (detailed)
|
||||
uses: lowlighter/metrics@<%- release %>
|
||||
<%- testcase({
|
||||
plugin_pagespeed: true,
|
||||
plugin_pagespeed_detailed: true,
|
||||
plugin_pagespeed_token: "${{ secrets.PAGESPEED_TOKEN }}",
|
||||
plugin_pagespeed_screenshot: true,
|
||||
}) %>
|
||||
|
||||
- name: ${{ matrix.template }} > Plugin > Music (playlist - apple)
|
||||
@@ -99,12 +93,6 @@ jobs:
|
||||
}) %>
|
||||
|
||||
- name: ${{ matrix.template }} > Plugin > Isocalendar
|
||||
uses: lowlighter/metrics@<%- release %>
|
||||
<%- testcase({
|
||||
plugin_isocalendar: true,
|
||||
}) %>
|
||||
|
||||
- name: ${{ matrix.template }} > Plugin > Isocalendar (full year)
|
||||
uses: lowlighter/metrics@<%- release %>
|
||||
<%- testcase({
|
||||
plugin_isocalendar: true,
|
||||
@@ -116,14 +104,6 @@ jobs:
|
||||
<%- testcase({
|
||||
plugin_habits: true,
|
||||
plugin_habits_from: 5,
|
||||
}) %>
|
||||
|
||||
- name: ${{ matrix.template }} > Plugin > Habits (charts)
|
||||
uses: lowlighter/metrics@<%- release %>
|
||||
<%- testcase({
|
||||
plugin_habits: true,
|
||||
plugin_habits_from: 5,
|
||||
plugin_habits_facts: false,
|
||||
plugin_habits_charts: true,
|
||||
}) %>
|
||||
|
||||
@@ -139,15 +119,10 @@ jobs:
|
||||
plugin_followup: true,
|
||||
}) %>
|
||||
|
||||
- name: ${{ matrix.template }} > Plugin > Lines
|
||||
- name: ${{ matrix.template }} > Plugin > Lines and Traffic
|
||||
uses: lowlighter/metrics@<%- release %>
|
||||
<%- testcase({
|
||||
plugin_lines: true,
|
||||
}) %>
|
||||
|
||||
- name: ${{ matrix.template }} > Plugin > Traffic
|
||||
uses: lowlighter/metrics@<%- release %>
|
||||
<%- testcase({
|
||||
plugin_traffic: true,
|
||||
}) %>
|
||||
|
||||
@@ -157,38 +132,27 @@ jobs:
|
||||
plugin_gists: true,
|
||||
}) %>
|
||||
|
||||
- name: ${{ matrix.template }} > Plugin > Topics (stars)
|
||||
uses: lowlighter/metrics@<%- release %>
|
||||
<%- testcase({
|
||||
plugin_topics: true,
|
||||
plugin_topics_sort: "stars",
|
||||
}) %>
|
||||
|
||||
- name: ${{ matrix.template }} > Plugin > Topics (activity)
|
||||
uses: lowlighter/metrics@<%- release %>
|
||||
<%- testcase({
|
||||
plugin_topics: true,
|
||||
plugin_topics_sort: "activity",
|
||||
}) %>
|
||||
|
||||
- name: ${{ matrix.template }} > Plugin > Topics (starred)
|
||||
uses: lowlighter/metrics@<%- release %>
|
||||
<%- testcase({
|
||||
plugin_topics: true,
|
||||
plugin_topics_sort: "starred",
|
||||
plugin_topics_mode: "starred",
|
||||
plugin_topics_sort: "random",
|
||||
}) %>
|
||||
|
||||
- name: ${{ matrix.template }} > Plugin > Topics (random)
|
||||
- name: ${{ matrix.template }} > Plugin > Topics (mastered)
|
||||
uses: lowlighter/metrics@<%- release %>
|
||||
<%- testcase({
|
||||
plugin_topics: true,
|
||||
plugin_topics_sort: "random",
|
||||
plugin_topics_mode: "mastered",
|
||||
plugin_topics_sort: "stars",
|
||||
}) %>
|
||||
|
||||
- name: ${{ matrix.template }} > Plugin > Projects
|
||||
uses: lowlighter/metrics@<%- release %>
|
||||
<%- testcase({
|
||||
plugin_projects: true,
|
||||
plugin_projects_repositories: "lowlighter/metrics/projects/1",
|
||||
plugin_projects_limit: 2,
|
||||
}) %>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user