Skip to content

Commit bf0032e

Browse files
authored
feat(app/action): add notice_releases option (lowlighter#1009) [skip ci]
1 parent c3ea358 commit bf0032e

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

source/app/action/index.mjs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ function quit(reason) {
141141
"output.action":_action,
142142
"output.condition":_output_condition,
143143
delay,
144+
"notice.release":_notice_releases,
144145
...config
145146
} = metadata.plugins.core.inputs.action({core, preset})
146147
const q = {...query, ...(_repo ? {repo:_repo} : null), template}
@@ -214,6 +215,15 @@ function quit(reason) {
214215
//Extract octokits
215216
const {graphql, rest} = api
216217

218+
//Check for new versions
219+
if (_notice_releases) {
220+
const {data:[{tag_name:tag}]} = await rest.repos.listReleases({owner:"lowlighter", repo:"metrics"})
221+
const current = Number(conf.package.version.match(/(\d+\.\d+)/)?.[1] ?? 0)
222+
const latest = Number(tag.match(/(\d+\.\d+)/)?.[1] ?? 0)
223+
if (latest > current)
224+
console.info(`::notice::A new version of metrics (v${latest}) has been released, check it out for even more features!`)
225+
}
226+
217227
//GitHub user
218228
let authenticated
219229
try {
@@ -301,7 +311,6 @@ function quit(reason) {
301311
else if (dryrun)
302312
info("Dry-run", true)
303313

304-
305314
//SVG file
306315
conf.settings.optimize = optimize
307316
info("SVG output", filename)

source/plugins/core/metadata.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,11 @@ inputs:
379379
min: 0
380380
max: 3600
381381

382+
notice_releases:
383+
description: Notice about new releases of metrics
384+
type: boolean
385+
default: yes
386+
382387
# ====================================================================================
383388
# 🚧 Options below are mostly used for testing
384389

0 commit comments

Comments
 (0)