Skip to content

Commit ed97262

Browse files
committed
Use committer.token instead of token to retrieve SHA and minor comments changes
1 parent a751545 commit ed97262

File tree

7 files changed

+16
-11
lines changed

7 files changed

+16
-11
lines changed

.github/readme/partials/setup/action.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ As the latter is used as a development branch, jobs may fail from time to time (
8989
When using a token with additional permissions, it is advised to fork this repository and use it instead to minimize security risks:
9090
```yaml
9191
- uses: my-github-username/metrics@master
92+
# If you make changes on your fork, be sure not leave @latest as tag!
9293
```
9394

9495
In this case, please consider watching new releases to stay up-to-date and enjoy latest features!

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ Generate your metrics that you can embed everywhere, including your GitHub profi
224224
<img alt="" width="400" src="https://github.com/lowlighter/lowlighter/blob/master/metrics.terminal.svg">
225225
<img width="900" height="1" alt="">
226226
</td>
227-
<td>See <a href="/source/templates/community/README.md">documentation</a> 🌍</td>
227+
<td align="center">See <a href="/source/templates/community/README.md">documentation</a> 🌍</td>
228228
</tr>
229229
</table>
230230

@@ -328,6 +328,7 @@ As the latter is used as a development branch, jobs may fail from time to time (
328328
When using a token with additional permissions, it is advised to fork this repository and use it instead to minimize security risks:
329329
```yaml
330330
- uses: my-github-username/metrics@master
331+
# If you make changes on your fork, be sure not leave @latest as tag!
331332
```
332333

333334
In this case, please consider watching new releases to stay up-to-date and enjoy latest features!

action.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -589,16 +589,17 @@ runs:
589589
docker image pull $METRICS_IMAGE > /dev/null
590590
# Official action
591591
elif [[ $METRICS_SOURCE == "lowlighter" ]]; then
592-
# Is unreleased version
592+
# Is released version
593593
set +e
594594
METRICS_IS_RELEASED=$(expr $(expr match $METRICS_VERSION .*-beta) == 0)
595595
set -e
596596
echo "Is released version: $METRICS_IS_RELEASED"
597-
# Rebuild image for unreleased version
597+
# Use registry for released version
598598
if [[ "$METRICS_IS_RELEASED" -gt "0" ]]; then
599599
echo "Using released version $METRICS_TAG, will pull docker image from GitHub registry"
600600
METRICS_IMAGE=ghcr.io/lowlighter/metrics:$METRICS_TAG
601-
# Use registry for released version
601+
docker image pull $METRICS_IMAGE > /dev/null
602+
# Rebuild image for unreleased version
602603
else
603604
echo "Using an unreleased version ($METRICS_VERSION)"
604605
METRICS_IMAGE=metrics:$METRICS_VERSION

source/app/action/action.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,17 @@ runs:
5959
docker image pull $METRICS_IMAGE > /dev/null
6060
# Official action
6161
elif [[ $METRICS_SOURCE == "lowlighter" ]]; then
62-
# Is unreleased version
62+
# Is released version
6363
set +e
6464
METRICS_IS_RELEASED=$(expr $(expr match $METRICS_VERSION .*-beta) == 0)
6565
set -e
6666
echo "Is released version: $METRICS_IS_RELEASED"
67-
# Rebuild image for unreleased version
67+
# Use registry for released version
6868
if [[ "$METRICS_IS_RELEASED" -gt "0" ]]; then
6969
echo "Using released version $METRICS_TAG, will pull docker image from GitHub registry"
7070
METRICS_IMAGE=ghcr.io/lowlighter/metrics:$METRICS_TAG
71-
# Use registry for released version
71+
docker image pull $METRICS_IMAGE > /dev/null
72+
# Rebuild image for unreleased version
7273
else
7374
echo "Using an unreleased version ($METRICS_VERSION)"
7475
METRICS_IMAGE=metrics:$METRICS_VERSION

source/app/action/index.mjs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import setup from "../metrics/setup.mjs"
66
import mocks from "../mocks/index.mjs"
77
import metrics from "../metrics/index.mjs"
8+
process.on("unhandledRejection", error => { throw error })
89

910
//Debug message buffer
1011
let DEBUG = true
@@ -31,7 +32,6 @@
3132
//Initialization
3233
info.break()
3334
info.section(`Metrics`)
34-
process.on("unhandledRejection", error => { throw error })
3535

3636
//Skip process if needed
3737
if ((github.context.eventName === "push")&&(github.context.payload?.head_commit)) {
@@ -133,7 +133,8 @@
133133
object(expression: "${committer.branch}:${filename}") { ... on Blob { oid } }
134134
}
135135
}
136-
`
136+
`,
137+
{headers:{authorization:`token ${committer.token}`}}
137138
)
138139
committer.sha = oid
139140
} catch (error) { console.debug(error) }

source/app/metrics/metadata.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@
262262
return {
263263
name:raw.match(/^### (?<name>[\s\S]+?)\n/)?.groups?.name?.trim(),
264264
readme:{
265-
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>"),
265+
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>"),
266266
compatibility:{...compatibility, base:true},
267267
},
268268
}

source/templates/community/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ By default, community templates use `template.mjs` from official `classic` templ
1010
If you trust it, append `+trust` after their name.
1111

1212
```yaml
13-
- uses: lowlighter/metrics@master
13+
- uses: lowlighter/metrics@latest
1414
with:
1515
# ... other options
1616
template: "@super-metrics"

0 commit comments

Comments
 (0)