Skip to content

Commit

Permalink
Update urlcheck.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
hillarymarler committed Aug 28, 2024
1 parent 88c6b5e commit bf012ac
Showing 1 changed file with 22 additions and 16 deletions.
38 changes: 22 additions & 16 deletions .github/workflows/urlcheck.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
name: URL Check

on:
push:
Expand All @@ -8,24 +9,29 @@ on:
# types: [published]
workflow_dispatch:

name: Check URLs

jobs:
build:
url_check:
runs-on: ubuntu-latest

steps:
name: Checkout repository
uses: actions/checkout@v3
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Set up R
uses: r-lib/actions/setup-r@v2

- name: Install curl
run: sudo apt-get install -y curl

name: Install dependencies
run: apt-get update && install -y curl
- name: Run URL check
run: |
Rscript -e "
urls <- c('https://github.com/USEPA/EPATADA/')
for (url in urls) {
status <- system(paste('curl -o /dev/null -s -w \"%{http_code}\"', url), intern = TRUE)
if (status != '200') {
stop(paste('URL check failed for', url))
}
}
"
name: Find and check URLs
run: |
grep -Eo '(http|https)://[^/"]+' -r . | while read -r url; do
if ! curl --output /dev/null --silent --head --fail "$url"; then
echo "Broken URL: $url"
exit 1
fi
done

0 comments on commit bf012ac

Please sign in to comment.