Skip to content

Commit

Permalink
Check broken links workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mirhamasala committed Oct 25, 2023
1 parent 59a5020 commit 711ca79
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/check-broken-links.yml
@@ -0,0 +1,48 @@
name: Check Broken Links

on:
schedule:
- cron: "0 2 * * 0"
workflow_dispatch:

jobs:
linkcheck:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Check links with linkcheck
uses: filiph/linkcheck@3.0.0
with:
arguments: https://www.mirhamasala.com --external --skip-file linkcheck-skip-file.txt > linkcheck-results.txt
id: linkcheck

- name: Upload linkcheck-results.txt as artifact
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: linkcheck-results
path: linkcheck-results.txt

- name: Create GitHub issue
if: ${{ failure() }}
uses: dacbd/create-issue-action@main
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "Content issue: Broken links found"
body: |
**Describe the issue**
During our scheduled (or manually-triggered) link check, the workflow named `check-broken-links` identified one or more broken links in the repository.
Details of the broken links, including their locations and the reasons for failure, can be found in the `linkcheck-results.txt` artifact, following the failed run link below.
[Failed Run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
[Codebase](https://github.com/${{ github.repository }}/tree/${{ github.sha }})
🔗 Workflow name - `${{ github.workflow }}`
📇 Job - `${{ github.job }}`
🚦 Status - `${{ job.status }}`
labels: "content"
assignees: mirhamasala
29 changes: 29 additions & 0 deletions linkcheck-skip-file.txt
@@ -0,0 +1,29 @@
# ================================
# linkcheck-skip-file
# ================================
#
# Purpose:
# This file is part of a GitHub Actions workflow named "Check Broken Links". It contains a list of URLs or links that
# are intended to be skipped during the automated link-checking process.
#
# Instructions:
# - Add the links that should be skipped by the "Check Broken Links" workflow to this file.
# - Each link should be on a new line.
# - Clearly document the reason for skipping each link.
# - Avoid using this file to bypass issues that can be resolved by correcting or updating the link.
#
# The workflow runs a job named "linkcheck" on a schedule and manually (workflow_dispatch). If the job fails,
# it uploads the results as an artifact and creates a GitHub issue notifying of the broken links found.
#
# Format:
# <URL> # Reason for skipping
#
# Example:
# http://example-broken-link.com # Broken link, site is down
#
# ================================

^https://www\.mirhamasala\.com/_next/.*
.*facebook\.com.*
.*instagram\.com.*
.*twitter\.com.*

1 comment on commit 711ca79

@vercel
Copy link

@vercel vercel bot commented on 711ca79 Oct 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.