Skip to content

Commit

Permalink
Make WEBSITE_URL required again
Browse files Browse the repository at this point in the history
  • Loading branch information
ScholliYT committed Oct 29, 2019
1 parent 1255294 commit 614ce79
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 23 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
# Broken-Links-Crawler-Action


This action checks a website for broken links like 404...
This action checks all links on a website. It will detect broken links i.e. links that return HTTP Code 403, 404...

## Inputs

### `website_url`

**Optional** The url of the website to check. Defaults to the homepage url of the repository (description). If that url is not set you'll have to set it in the yml (The piority of GitHub's homepage url is higher than the parameter).
**Required** The url of the website to check.

### `verbose`

Expand Down
3 changes: 1 addition & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ description: 'Checks a webiste for broken links'
inputs:
website_url: # id of input
description: 'Which website to check'
required: false
default: ''
required: true
verbose:
description: 'Turn verbose mode on/off'
require: false
Expand Down
21 changes: 3 additions & 18 deletions deadseeker.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,24 +78,9 @@ def handle_link(self, link):
if self.home in link:
self.pages_to_check.appendleft(link)


# read env variables
github_event_json = os.environ['GITHUB_EVENT_PATH']
with open(github_event_json) as f:
d = json.load(f)
jsondump = json.dumps(d)
print("::debug ::" + str(jsondump))
repository_homepage_url = d['repository']['homepage']
print("homepage url found in repository: {}".format(repository_homepage_url))

if repository_homepage_url != "":
website_url = repository_homepage_url
else:
website_url = os.environ['INPUT_WEBSITE_URL']
if website_url == "":
print("::error ::Can't find website_url!")
sys.exit(1)
website_url = os.environ['INPUT_WEBSITE_URL']
verbose = os.environ['INPUT_VERBOSE']
print(website_url)
print(verbose)
print("Checking website: " + str(website_url))
print("Verbose mode on: " + str(verbose))
LinkParser(website_url, verbose)

0 comments on commit 614ce79

Please sign in to comment.