From e42b4701c493c46ffa2a40d1d50a34a5c0d16d53 Mon Sep 17 00:00:00 2001 From: borgified Date: Fri, 7 Aug 2020 10:31:51 -0700 Subject: [PATCH] Add awesome bot (#3662) * add awesome_bot to check urls * allow dupes * make url checking dependent on commit message * add web.archive.org to whitelist cuz awesome_bot is having trouble with those links * fix travis.yaml * check urls * need ruby * another site to avoid * check urls * make regex more generic * sudo deprecated * make travis linter happy check url * try skip results check url * timeout was what was killing us check url * testing fixing urls check url * dont allow timeout check url * testing timeout check url * put fpb back check url * enable to check_urls on arbitrary files check_urls:free-programming-books.md * try again check_urls:free-programming-books.md * test again check_urls:free-programming-books.md * travis doesnt like : check_urls=free-programming-books.md * allow arbitrary number of files to be checked check_urls=free-programming-books.md * woops forgot to fix the trigger regex check_urls=free-programming-books.md free-programming-books-en.md * use for loop instead of xargs check_urls=free-programming-books.md free-programming-books-en.md * add documentation --- .travis.yml | 31 ++++++++++++++++++++++++------- CONTRIBUTING.md | 12 ++++++++++++ 2 files changed, 36 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 781ab558..579e5947 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,24 @@ -language: node_js -sudo: false -node_js: - - 6 -before_script: - - npm install -g free-programming-books-lint -script: fpb-lint . +language: shell +dist: xenial +os: linux + +jobs: + include: + - + language: node_js + node_js: + - 6 + before_script: + - npm install -g free-programming-books-lint + script: + - fpb-lint . + + - + language: ruby + if: commit_message =~ /check_urls=/ + rvm: 2.4.1 + before_script: + - gem install awesome_bot + script: + - INPUT=$(echo $TRAVIS_COMMIT_MESSAGE | awk -F= '{print $2}') + - for i in $INPUT; do echo "processing $i"; awesome_bot $i --allow-redirect --allow-dupe --skip-save-results; done diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dd5680fa..b0bbf211 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -118,3 +118,15 @@ GOOD: * [A Very Awesome Book (1970)](https://example.org/book.html) - Jane Roe ``` GOOD: * [Will Be Awesome Soon Book](http://example.com/book2.html) - John Doe (HTML) (:construction: *in process*) ``` + +### Automation +- Formatting rules enforcement is automated via [Travis CI](https://travis-ci.com) using [fpb-lint](https://github.com/vhf/free-programming-books-lint) (see [.travis.yml](.travis.yml)) +- URL validation uses [awesome_bot](https://github.com/dkhamsing/awesome_bot) +- To trigger URL validation, push a commit that includes a commit message containing `check_urls=file_to_check`: + +``` +check_urls=free-programming-books.md free-programming-books-en.md +``` + +- You may specify more than one file to check, using a single space to separate each entry. +- If you specify more than one file, results of the build is based on the result of the last file checked. You should be aware that you may get passing green builds due to this so be sure to inspect the build log at the end of the pull request by clicking on "Show all checks" -> "Details". -- GitLab