-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add action-readme pre-commit hook (#23)
* Add action-readme pre-commit hook * fixes * Fix pre-commit workflow * Fix gh usage * fix gh cli extension name * Add VERSION env * Move VERSION env to script * Add instructions for pre-commit and gh cli
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
# This script updates the README.md files in the directories that contain both an action.yml and a README.md file. | ||
# Prerequisites: | ||
# - gh: GitHub CLI | ||
# | ||
set -euo pipefail | ||
|
||
function find_dirs_with_action_yml_and_readme_md() { | ||
find . \( -name 'action.yml' -o -name 'README.md' \) -exec dirname {} \; \ | ||
| sort \ | ||
| uniq -c \ | ||
| grep -E '^\s+2' \ | ||
| awk '{ print $2 }' | ||
} | ||
|
||
for dir in $(find_dirs_with_action_yml_and_readme_md); do | ||
VERSION=v1 gh action-readme update --action="$dir/action.yml" --readme="$dir/README.md" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,5 +13,9 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install gh-action-readme | ||
run: gh extension install reakaleek/gh-action-readme --pin v0.2.0 | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
- uses: actions/setup-python@v5 | ||
- uses: pre-commit/[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters