Skip to content

Commit

Permalink
Check if files and dirs exist
Browse files Browse the repository at this point in the history
  • Loading branch information
gaurav-nelson committed Aug 19, 2020
1 parent 1c4f53a commit ed25e2f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
uses: ./
with:
use-quiet-mode: 'yes'
folder-path: 'md/dir1, md/dir2'
folder-path: 'md/dir1, md/dir2, md/dir4'
file-path: './README.md, ./LICENSE, ./md/file4.markdown'
shellcheck:
runs-on: [ubuntu-latest]
Expand Down
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ NC='\033[0m' # No Color
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
BLUE='\033[0;34m'
RED='\033[0;31m'

npm i -g markdown-link-check@3.8.1

Expand Down Expand Up @@ -52,6 +53,10 @@ handle_dirs () {

for index in "${!DIRLIST[@]}"
do
if [ ! -d "${DIRLIST[index]}" ]; then
echo -e "${RED} Can't find the directory: ${DIRLIST[index]}"
exit 2
fi
COMMAND_DIRS+=("${DIRLIST[index]}")
done
FOLDERS="${COMMAND_DIRS[*]}"
Expand All @@ -64,6 +69,10 @@ handle_files () {

for index in "${!FILELIST[@]}"
do
if [ ! -f "${FILELIST[index]}" ]; then
echo -e "${RED} Can't find the file: ${FILELIST[index]}"
exit 2
fi
if [ $index == 0 ]; then
COMMAND_FILES+=("-wholename ${FILELIST[index]}")
else
Expand Down

0 comments on commit ed25e2f

Please sign in to comment.