-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run tests on PRs, only trigger docs when content changed
- Loading branch information
Showing
3 changed files
with
27 additions
and
2 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# generate docs | ||
forge doc -b -o docs/html | ||
|
||
# Unstage all docs where only the commit hash changed | ||
# Get a list of all unstaged files in the directory | ||
files=$(git diff --name-only -- 'docs/html/*') | ||
|
||
# Loop over each file | ||
for file in $files; do | ||
# Get the diff for the file, only lines that start with - or + | ||
diff=$(git diff $file | grep '^[+-][^+-]') | ||
echo $file | ||
echo "$diff" | wc -l | ||
# Check if there are any other changes in the diff besides the commit hash (in that case the file has more than 1 line that changed, one minus one plus) | ||
if [[ $(echo "$diff" | wc -l) -eq 2 ]]; then | ||
# If there are no other changes, discard the changes for the file | ||
git reset HEAD $file | ||
git checkout -- $file | ||
fi | ||
done |