Skip to content

Commit c311faf

Browse files
committed
Add support for showing stats
1 parent 808d98b commit c311faf

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,13 @@ Default is `false`.
7676
(Optional) Path to your linkspector configuration file `.linkspector.yml`.
7777
For more details, see [Linkspector configuration](https://github.com/UmbrellaDocs/linkspector?tab=readme-ov-file#configuration).
7878

79+
### `show_stats`
80+
81+
(Optional) Show statistics about the checked links [true,false].
82+
Default is `false`.
83+
84+
**Note:** Enabling the `show_stats` option causes Linkspector to run twice: once for reporting and again to collect statistics. Using this will increase the total run time of the action.
85+
7986
### Real-life usage samples
8087

8188
Following is a list of some of the repositories which are using GitHub Action -

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ inputs:
4343
description: Specify the path for the Linkspector YML configuration file.
4444
required: true
4545
default: .linkspector.yml
46+
show_stats:
47+
description: Show statistics about the checked links.
48+
required: false
49+
default: "false"
4650
runs:
4751
using: composite
4852
steps:
@@ -76,6 +80,7 @@ runs:
7680
INPUT_FAIL_LEVEL: ${{ env.INPUT_FAIL_LEVEL }}
7781
INPUT_REVIEWDOG_FLAGS: ${{ inputs.reviewdog_flags }}
7882
INPUT_CONFIG_FILE: ${{ inputs.config_file }}
83+
INPUT_SHOW_STATS: ${{ inputs.show_stats }}
7984
branding:
8085
icon: link-2
8186
color: blue

script.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,11 @@ linkspector check -c "${INPUT_CONFIG_FILE}" -j |
3333
"${INPUT_REVIEWDOG_FLAGS}"
3434
exit_code=$?
3535
echo '::endgroup::'
36+
37+
if [ "${INPUT_SHOW_STATS}" = "true" ]; then
38+
echo '::group:: Running linkspector stats ...'
39+
linkspector check -c "${INPUT_CONFIG_FILE}" -s || true
40+
echo '::endgroup::'
41+
fi
42+
3643
exit $exit_code

0 commit comments

Comments
 (0)