From f9ff0752adb16439de9b51d8b08632dcc310a60a Mon Sep 17 00:00:00 2001 From: Victor Date: Mon, 18 Mar 2024 23:18:34 +0000 Subject: [PATCH] ci(pre-commit): add action-docs --- .pre-commit-config.yaml | 7 +++++++ script/update-action-readme | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 script/update-action-readme diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4216f58..f249081 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,3 +23,10 @@ repos: - id: actionlint # actionlint doesn't like the uses: ./ exclude: ci.yaml + - repo: local + hooks: + - id: update-action-readme + name: update-action-readme + entry: ./script/update-action-readme + language: script + files: '.*/action\.yaml$' diff --git a/script/update-action-readme b/script/update-action-readme new file mode 100755 index 0000000..c357063 --- /dev/null +++ b/script/update-action-readme @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -e + +for i in $*; do + # ignore if the file does not end with /action.yaml + if [[ "$i" != *"action.yaml" ]]; then + echo "skipping: ${i}" + continue + fi + readme_file=$(dirname "$i")/README.md + echo "npx action-docs --no-banner -s "${i}"" + npx action-docs@2 --no-banner -s "${i}" -u "${readme_file}" +done