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 a400130 commit 3505669
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions .github/workflows/urlcheck.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Workflow derived from https://github.com/technote-space/broken-link-checker-action

on:
push:
branches: [hrm_test]
Expand All @@ -8,7 +8,7 @@ on:
# types: [published]
workflow_dispatch:

name: Broken Link Check
name: Check for Broken Links

jobs:
check-links:
Expand All @@ -25,8 +25,17 @@ jobs:
run: |
install.packages(c("xml2", "rvest", "httr"))
- name: Run Broken Link Checker
uses: technote-space/broken-link-checker-action@v2
with:
target: 'https://github.com/USEPA/EPATADA/' # Replace with your package URL
recursive: true
- name: Check for Broken Links
run: |
Rscript -e "library(xml2); library(rvest); library(httr); \
urls <- c('https://github.com/USEPA/EPATADA/'); \
for (url in urls) { \
page <- read_html(url); \
links <- html_nodes(page, 'a') %>% html_attr('href'); \
for (link in links) { \
res <- GET(link); \
if (status_code(res) >= 400) { \
stop(paste('Broken link:', link)); \
} \
} \
}"

0 comments on commit 3505669

Please sign in to comment.