Add "repo" option (syntaxic sugar for query) and defaults committer_token

This commit is contained in:
lowlighter
2021-02-27 15:13:01 +01:00
parent 42cbc6f1cd
commit 8c16f54851
2 changed files with 17 additions and 5 deletions

View File

@@ -50,7 +50,7 @@
//Core inputs
const {
user:_user, token,
user:_user, repo:_repo, token,
template, query, "setup.community.templates":_templates,
filename, optimize, verify,
debug, "debug.flags":dflags, "use.mocked.data":mocked, dryrun,
@@ -59,7 +59,7 @@
"use.prebuilt.image":_image,
...config
} = metadata.plugins.core.inputs.action({core})
const q = {...query, template}
const q = {...query, repo:_repo, template}
//Docker image
if (_image)
@@ -101,6 +101,8 @@
}
const user = _user || authenticated
info("GitHub account", user)
if (q.repo)
info("GitHub repository", `${user}/${q.repo}`)
//Current repository
info("Current repository", `${github.context.repo.owner}/${github.context.repo.repo}`)

View File

@@ -18,16 +18,26 @@ inputs:
required: true
# GitHub username
# Defaults to "token" owner
user:
description: GitHub username
type: string
default: "" # Defaults to "token" owner
default: ""
# Set to "${{ secrets.GITHUB_TOKEN }}"
# GitHub repository
# Compute metrics for a repository instead ("user" being the repository owner)
# Check https://github.com/lowlighter/metrics/blob/master/source/templates/repository/README.md for more informations
repo:
description: GitHub repository
type: string
default: ""
# Set to "${{ github.token }}" or "${{ secrets.GITHUB_TOKEN }}"
# GITHUB_TOKEN is a special auto-generated token restricted to current repository, which is used to push files in it
committer_token:
description: GitHub Token used to commit metrics
type: token
default: "" # Defaults to "token"
default: ${{ github.token }}
# Branch used to commit rendered metrics
committer_branch: