link-checker #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: link-checker | |
# Controls when the workflow will run | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
check-external-links: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.11.3 | |
- name: Run linkchecker into file | |
continue-on-error: true | |
run: | | |
pip install linkchecker | |
linkchecker --no-robots --no-warnings --config .linkcheckerrc --file-output=csv/utf-8/linkchecker_raw_output.csv --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36" --check-extern https://www.arm.com/developer-hub/ecosystem-dashboard/servers-and-cloud-computing | |
cat linkchecker_raw_output.csv | |
- name: Parse through allow-listed URLs | |
run: | | |
ls | |
python --version | |
python ./build_steps/linkchecker_filter_out_allowed_urls.py | |
cat linkchecker_raw_output.csv | |
cat linkchecker_filtered_output.csv | |
- name: Read and validate filtered CSV | |
run: | | |
# Read the filtered CSV file | |
csv_content=$(<linkchecker_filtered_output.csv) | |
# Print the contents of the CSV | |
echo "Filtered CSV content:" | |
echo "$csv_content" | |
# Check if CSV content is empty | |
if [ -z "$csv_content" ]; then | |
echo "No URLs found in the filtered CSV." | |
else | |
echo "Error: URLs found in the filtered CSV." | |
exit 1 | |
fi |