File tree Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -17,11 +17,17 @@ This GitHub action checks all Markdown files in your repository for broken links
1717       - uses: actions/checkout@master
1818         with:
1919           fetch-depth: 1
20-        - uses: gaurav-nelson/github-action-markdown-link-check@0.2 .0
20+        - uses: gaurav-nelson/github-action-markdown-link-check@0.3 .0
2121   ```
22+ 1. To use a [custom configuration](https://github.com/tcort/markdown-link-check#config-file-format)
23+    for markdown-link-check, create a JSON configuration file and save it in the
24+    root filder as `mlc_config.json`.
2225
2326## Test links
2427
2528www.google.com
2629
2730[This is a broken link](www.exampleexample.cox)
31+ 
32+ [This is another broken link](http://ignored-domain.com) but its ignored using a
33+ configuration file. 
Original file line number Diff line number Diff line change 22
33set -eu
44
5+ NC='\033[0m' # No Color
6+ GREEN='\033[0;32m'
7+ YELLOW='\033[0;33m'
8+ BLUE='\033[0;34m'
9+ 
510npm i -g markdown-link-check
611
7- echo "=========================> MARKDOWN LINK CHECK <========================="
12+ CONFIG_FILE=mlc_config.json
13+ 
14+ echo -e "${YELLOW}=========================> MARKDOWN LINK CHECK <=========================${NC}"
815
9- find . -name \*.md -not -path "./node_modules/*" -exec markdown-link-check {} \; 2> error.txt
16+ if [ -f "$CONFIG_FILE" ]; then
17+     echo -e "${BLUE}Using markdown-link-check configuration file: ${YELLOW}$CONFIG_FILE${NC}"
18+     find . -name \*.md -not -path "./node_modules/*" -exec markdown-link-check {} --config "$CONFIG_FILE" \; 2> error.txt
19+ else 
20+     echo -e "${BLUE}Cannot find ${YELLOW}$CONFIG_FILE${NC}"
21+     echo -e "${YELLOW}NOTE: See https://github.com/tcort/markdown-link-check#config-file-format to know more about"
22+     echo -e "customizing markdown-link-check by using a configuration file.${NC}"
23+     find . -name \*.md -not -path "./node_modules/*" -exec markdown-link-check {} \; 2> error.txt
24+ fi
1025
11- echo " ========================================================================="
26+ echo -e "${YELLOW} =========================================================================${NC} "
1227
1328if [ -e error.txt ] ; then
1429  if grep -q "ERROR:" error.txt; then
1530    exit 113
1631  fi
32+ else
33+   echo -e "${GREEN}All good!${NC}"
1734fi
Original file line number Diff line number Diff line change 1+ {
2+     "ignorePatterns": [
3+         {
4+             "pattern": "^http://ignored-domain.com"
5+         }
6+     ]
7+ }
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments