Use committer.token instead of token to retrieve SHA and minor comments changes

This commit is contained in:
lowlighter
2021-01-30 23:44:47 +01:00
parent a7515454cc
commit ed97262d40
7 changed files with 16 additions and 11 deletions

View File

@@ -89,6 +89,7 @@ As the latter is used as a development branch, jobs may fail from time to time (
When using a token with additional permissions, it is advised to fork this repository and use it instead to minimize security risks:
```yaml
- uses: my-github-username/metrics@master
# If you make changes on your fork, be sure not leave @latest as tag!
```
In this case, please consider watching new releases to stay up-to-date and enjoy latest features!

View File

@@ -224,7 +224,7 @@ Generate your metrics that you can embed everywhere, including your GitHub profi
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.terminal.svg">
<img width="900" height="1" alt="">
</td>
<td>See <a href="/source/templates/community/README.md">documentation</a> 🌍</td>
<td align="center">See <a href="/source/templates/community/README.md">documentation</a> 🌍</td>
</tr>
</table>
@@ -328,6 +328,7 @@ As the latter is used as a development branch, jobs may fail from time to time (
When using a token with additional permissions, it is advised to fork this repository and use it instead to minimize security risks:
```yaml
- uses: my-github-username/metrics@master
# If you make changes on your fork, be sure not leave @latest as tag!
```
In this case, please consider watching new releases to stay up-to-date and enjoy latest features!

View File

@@ -589,16 +589,17 @@ runs:
docker image pull $METRICS_IMAGE > /dev/null
# Official action
elif [[ $METRICS_SOURCE == "lowlighter" ]]; then
# Is unreleased version
# Is released version
set +e
METRICS_IS_RELEASED=$(expr $(expr match $METRICS_VERSION .*-beta) == 0)
set -e
echo "Is released version: $METRICS_IS_RELEASED"
# Rebuild image for unreleased version
# Use registry for released version
if [[ "$METRICS_IS_RELEASED" -gt "0" ]]; then
echo "Using released version $METRICS_TAG, will pull docker image from GitHub registry"
METRICS_IMAGE=ghcr.io/lowlighter/metrics:$METRICS_TAG
# Use registry for released version
docker image pull $METRICS_IMAGE > /dev/null
# Rebuild image for unreleased version
else
echo "Using an unreleased version ($METRICS_VERSION)"
METRICS_IMAGE=metrics:$METRICS_VERSION

View File

@@ -59,16 +59,17 @@ runs:
docker image pull $METRICS_IMAGE > /dev/null
# Official action
elif [[ $METRICS_SOURCE == "lowlighter" ]]; then
# Is unreleased version
# Is released version
set +e
METRICS_IS_RELEASED=$(expr $(expr match $METRICS_VERSION .*-beta) == 0)
set -e
echo "Is released version: $METRICS_IS_RELEASED"
# Rebuild image for unreleased version
# Use registry for released version
if [[ "$METRICS_IS_RELEASED" -gt "0" ]]; then
echo "Using released version $METRICS_TAG, will pull docker image from GitHub registry"
METRICS_IMAGE=ghcr.io/lowlighter/metrics:$METRICS_TAG
# Use registry for released version
docker image pull $METRICS_IMAGE > /dev/null
# Rebuild image for unreleased version
else
echo "Using an unreleased version ($METRICS_VERSION)"
METRICS_IMAGE=metrics:$METRICS_VERSION

View File

@@ -5,6 +5,7 @@
import setup from "../metrics/setup.mjs"
import mocks from "../mocks/index.mjs"
import metrics from "../metrics/index.mjs"
process.on("unhandledRejection", error => { throw error })
//Debug message buffer
let DEBUG = true
@@ -31,7 +32,6 @@
//Initialization
info.break()
info.section(`Metrics`)
process.on("unhandledRejection", error => { throw error })
//Skip process if needed
if ((github.context.eventName === "push")&&(github.context.payload?.head_commit)) {
@@ -133,7 +133,8 @@
object(expression: "${committer.branch}:${filename}") { ... on Blob { oid } }
}
}
`
`,
{headers:{authorization:`token ${committer.token}`}}
)
committer.sha = oid
} catch (error) { console.debug(error) }

View File

@@ -262,7 +262,7 @@
return {
name:raw.match(/^### (?<name>[\s\S]+?)\n/)?.groups?.name?.trim(),
readme:{
demo:raw.match(/(?<demo><table>[\s\S]*?<[/]table>)/)?.groups?.demo?.replace(/<[/]?(?:table|tr)>/g, "")?.trim() ?? (name === "community" ? `<td>See <a href="/source/templates/community/README.md">documentation</a> 🌍</td>` : "<td></td>"),
demo:raw.match(/(?<demo><table>[\s\S]*?<[/]table>)/)?.groups?.demo?.replace(/<[/]?(?:table|tr)>/g, "")?.trim() ?? (name === "community" ? `<td align="center">See <a href="/source/templates/community/README.md">documentation</a> 🌍</td>` : "<td></td>"),
compatibility:{...compatibility, base:true},
},
}

View File

@@ -10,7 +10,7 @@ By default, community templates use `template.mjs` from official `classic` templ
If you trust it, append `+trust` after their name.
```yaml
- uses: lowlighter/metrics@master
- uses: lowlighter/metrics@latest
with:
# ... other options
template: "@super-metrics"