Skip to content
Permalink
Browse files

Check broken links

  • Loading branch information...
richelbilderbeek committed Jun 22, 2019
1 parent f0d5e4c commit 77e521dddd2aa51e44e9f9831fb72848f757ef7d
Showing with 35 additions and 0 deletions.
  1. +13 −0 .travis.yml
  2. +4 −0 README.md
  3. BIN pics/TravisCI.png
  4. +18 −0 scripts/check_dead_links
@@ -0,0 +1,13 @@
language: generic
dist: xenial

install:
# Check dead links
- sudo apt-get install -qq npm
- npm config set strict-ssl false
- sudo npm install -g markdown-link-check

script:
# Check dead links
- rm .travis.yml
- ./scripts/check_dead_links
@@ -1,5 +1,9 @@
# Pi Approximation Day

Branch|[![Travis CI logo](pics/TravisCI.png)](https://travis-ci.org)
---|---
`master`|[![Build Status](https://travis-ci.org/richelbilderbeek/pi_approximation_day.svg?branch=master)](https://travis-ci.org/richelbilderbeek/pi_approximation_day)

Since 2012, I celebrate Pi Approximation Day by approximating pi
with streetchalk at the Noorderplantsoen Groningen.

BIN +5.29 KB pics/TravisCI.png
Binary file not shown.
@@ -0,0 +1,18 @@
#!/bin/bash

# Collect all dead links in a file
find . -name \*.md -exec markdown-link-check {} \; 2>/dev/null | egrep "[✖]" > broken.txt

# Count the number of lines, extract only that number
n_broken=$(wc broken.txt --lines | cut -f 1 -d " ")

if [[ $n_broken > 0 ]]
then
echo "Number of broken files: "$n_broken
cat broken.txt
rm broken.txt
exit $n_broken
fi

rm broken.txt

0 comments on commit 77e521d

Please sign in to comment.
You can’t perform that action at this time.