feat(app/action): add notice_releases option (#1009) [skip ci]

This commit is contained in:
Simon Lecoq
2022-04-23 20:36:40 +02:00
committed by GitHub
parent c3ea358446
commit bf0032ee57
2 changed files with 15 additions and 1 deletions

View File

@@ -141,6 +141,7 @@ function quit(reason) {
"output.action":_action,
"output.condition":_output_condition,
delay,
"notice.release":_notice_releases,
...config
} = metadata.plugins.core.inputs.action({core, preset})
const q = {...query, ...(_repo ? {repo:_repo} : null), template}
@@ -214,6 +215,15 @@ function quit(reason) {
//Extract octokits
const {graphql, rest} = api
//Check for new versions
if (_notice_releases) {
const {data:[{tag_name:tag}]} = await rest.repos.listReleases({owner:"lowlighter", repo:"metrics"})
const current = Number(conf.package.version.match(/(\d+\.\d+)/)?.[1] ?? 0)
const latest = Number(tag.match(/(\d+\.\d+)/)?.[1] ?? 0)
if (latest > current)
console.info(`::notice::A new version of metrics (v${latest}) has been released, check it out for even more features!`)
}
//GitHub user
let authenticated
try {
@@ -301,7 +311,6 @@ function quit(reason) {
else if (dryrun)
info("Dry-run", true)
//SVG file
conf.settings.optimize = optimize
info("SVG output", filename)

View File

@@ -379,6 +379,11 @@ inputs:
min: 0
max: 3600
notice_releases:
description: Notice about new releases of metrics
type: boolean
default: yes
# ====================================================================================
# 🚧 Options below are mostly used for testing