Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP modified files only with folder path #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/push.yml
Expand Up @@ -17,8 +17,10 @@ jobs:
uses: ./
with:
# Add a test to restrict the test to just dir4 and dir5.
folder-path: './md/dir4, ./md/dir5'
file-path: './md/AdditionalFileTest1.md, ./md/AdditionalFileTest2.md'
folder-path: 'md/dir4/, md/dir5/'
file-path: 'md/AdditionalFileTest1.md, md/AdditionalFileTest2.md'
check-modified-files-only: 'yes'
use-verbose-mode: 'yes'
shellcheck:
runs-on: [ubuntu-latest]
steps:
Expand Down
21 changes: 14 additions & 7 deletions entrypoint.sh
Expand Up @@ -8,7 +8,7 @@ YELLOW='\033[0;33m'
BLUE='\033[0;34m'
RED='\033[0;31m'

npm i -g markdown-link-check@3.8.6
npm i -g markdown-link-check@3.8.7

declare -a FIND_CALL
declare -a COMMAND_DIRS COMMAND_FILES
Expand Down Expand Up @@ -142,7 +142,7 @@ check_additional_files () {

}

if [ -z "$8" ]; then
if [ -z "$4" ]; then
FOLDERS="."
else
handle_dirs
Expand All @@ -167,16 +167,23 @@ if [ "$CHECK_MODIFIED_FILES" = "yes" ]; then

for i in "${FILE_ARRAY[@]}"
do
echo "------------------------------> filename is ${i}"
if [ "${i##*.}" == "${FILE_EXTENSION#.}" ]; then
FIND_CALL+=("${i}")
COMMAND="${FIND_CALL[*]}"
$COMMAND &>> error.txt || true
unset 'FIND_CALL[${#FIND_CALL[@]}-1]'
echo "------------------------------> File extension match"
echo "------------------------------> filename: ${i##*/}"
if [ $(find ${FOLDERS} -name "${i##*/}" ) ]; then
echo "------------------------------> folders is ${FOLDERS}"
FIND_CALL+=("${i}")
COMMAND="${FIND_CALL[*]}"
echo "------------------------------> Command is ${COMMAND}"
$COMMAND &>> error.txt || true
unset 'FIND_CALL[${#FIND_CALL[@]}-1]'
fi
fi
done

check_additional_files

check_errors

else
Expand Down
6 changes: 6 additions & 0 deletions md/dir4/ok4.md
Expand Up @@ -4,3 +4,9 @@

Go to [Ok5](../dir5/ok5.md#test)

This [doesn't exists](#alpha).
But [missing files are reported](missing-example.js).

What about refs and definitions are [checked][beta].

[beta]: #beta
2 changes: 1 addition & 1 deletion md/file1.md
Expand Up @@ -13,7 +13,7 @@ This is to test URLencoding.
<https://en.wikipedia.org/wiki/Glob_%28programming%29>
<https://www.google.com/?q=url%20with%20a%20space>

### Alpha
### Alpha check

This [exists](#alpha).
<!-- markdown-link-check-disable-next-line -->
Expand Down