Repository: Lightning-AI/pytorch-lightning
Pull request: Check broken links
## What does this PR do?

Fixes #8107
This checks for broken links in all markdown files.
- [x] For markdown files, I have created a new workflow based on [this](https://github.com/gaurav-nelson/github-action-markdown-link-check)
- [x] Skips checks on links of the form, `^https://github.com/Lightning-AI/lightning/pull/.*` (to ignore checks in CHANGELOG) 
- [x] There was an azure link (in `README.md` and `src/pytorch_lightning/README.`md) with `(` and `)` in the link which caused the `mdformat` pre-commit hook to update the link with `<` and `>`. This causes the md-link-check to fail. Update the link with replacing `(` with `$28` and `)` with `$29` encoding. This resolves it.
- [x] Added a json file in the `workflows/` directory to allow for modifying the parameters of the markdown link check. Currently situated at [markdown.links.config.json](https://github.com/Lightning-AI/lightning/pull/16168/files#diff-385b43dfa854b53c3a86b3c5ccd92246d21bc40ca2e81bfb178ca97a1048ae87), it contains some configuration to allow for loading of github links. 
- [x] Fixed two links that were not fixed in the #16191 
- [x] Fabric Doc Links were incorrect in multiple places, fixed them.
<!--
Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context.
List any dependencies that are required for this change.

If we didn't discuss your PR in Github issues there's a high chance it will not be merged.

The following links the related issue to the PR (https://docs.github.com/en/free-pro-team@latest/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)
-->

### Does your PR introduce any breaking changes? If yes, please list them.

<!-- FILL IN or None -->

## Before submitting

- [x] Was this **discussed/approved** via a GitHub issue? (not for typos and docs)
- [x] Did you read the [contributor guideline](https://github.com/Lightning-AI/lightning/blob/master/.github/CONTRIBUTING.md), **Pull Request** section?
- [x] Did you make sure your **PR does only one thing**, instead of bundling different changes together?
- [ ] Did you make sure to **update the documentation** with your changes? (if necessary)
- [ ] Did you write any **new necessary tests**? (not for typos and docs)
- [ ] Did you verify new and **existing tests pass** locally with your changes?
- [ ] Did you list all the **breaking changes** introduced by this pull request?
- [ ] Did you **update the CHANGELOG**? (not for typos, docs, test updates, or minor internal changes/refactors)

<!-- In the CHANGELOG, separate each item in the unreleased section by a blank line to reduce collisions -->

## PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the [review guidelines](https://github.com/Lightning-AI/lightning/wiki/Review-guidelines). In short, see the following bullet-list:

- [x] Is this pull request ready for review? (if not, please submit in draft mode)
- [x] Check that all items from **Before submitting** are resolved
- [x] Make sure the title is self-explanatory and the description concisely explains the PR
- [x] Add labels and milestones (and optionally projects) to the PR so it can be classified

## Did you have fun?

Make sure you had fun coding 🙃


Problem statement:
Testing URL links in docs & readme
## 🚀 Feature

it may easily happen that some external links are not valid anymore so we shall test them all...

### Motivation

detect broken links in the process

### Alternatives

load the URLs via bs4? (a web scraping tool)
assert that the text you get back contains an expected string?

### Additional context

<!-- Add any other context or screenshots about the feature request here. -->

Hints from issue discussion:
Is [CheckExternalLinksBuilder](https://www.sphinx-doc.org/en/master/usage/builders/index.html#sphinx.builders.linkcheck.CheckExternalLinksBuilder) what you're looking for? It only checks links in the docs  though.
I can take this up!

Commit message: Merge branch 'master' into check-dead-links

Patch to review:
diff --git a/.github/workflows/docs-checks.yml b/.github/workflows/docs-checks.yml
index 03cf7fb4e6497..8c18a5c5a3f58 100644
--- a/.github/workflows/docs-checks.yml
+++ b/.github/workflows/docs-checks.yml
@@ -157,7 +157,8 @@ jobs:
       - name: Make Documentation
         working-directory: ./docs/source-${{ matrix.pkg-name }}
         run: |
-          make html --debug --jobs $(nproc) SPHINXOPTS="-W --keep-going"
+          make clean
+          make html --debug --jobs $(nproc) SPHINXOPTS="-W --keep-going" -b linkcheck
 
       - name: Upload built docs
         uses: actions/upload-artifact@v3
diff --git a/.github/workflows/md-check-links.yml b/.github/workflows/md-check-links.yml
new file mode 100644
index 0000000000000..f31ceb06970aa
--- /dev/null
+++ b/.github/workflows/md-check-links.yml
@@ -0,0 +1,28 @@
+name: Check Markdown links
+# https://github.com/gaurav-nelson/github-action-markdown-link-check
+
+on:
+  push:
+    branches: [master, "release/*"]
+  pull_request:
+    branches: [master, "release/*"]
+    types: [opened, reopened, ready_for_review, synchronize]
+    paths:
+      - "!*.md"
+      - ".github/**"
+      - "src/**"
+      - "tests/**"
+      - "requirements/**"
+      - "setup.py"
+      - "examples/**"
+      - "dockers/**"
+      - "!**/*.md"
+
+jobs:
+  markdown-link-check:
+    runs-on: ubuntu-20.04
+    steps:
+    - uses: actions/checkout@master
+    - uses: gaurav-nelson/github-action-markdown-link-check@v1
+      with:
+        use-quiet-mode: 'yes'


Code review comments:
diff_hunk: @@ -0,0 +1,28 @@
+name: Check Markdown links
+# https://github.com/gaurav-nelson/github-action-markdown-link-check
+
+on:
+  push:
+    branches: [master, "release/*"]
+  pull_request:
+    branches: [master, "release/*"]
+    types: [opened, reopened, ready_for_review, synchronize]
+    paths:
+      - "!*.md"
+      - ".github/**"
+      - "src/**"
+      - "tests/**"
+      - "requirements/**"
+      - "setup.py"
+      - "examples/**"
+      - "dockers/**"
+      - "!**/*.md"
path: .github/workflows/md-check-links.yml
text: @user1:
```suggestion
      - ".github/workflows/md-check-links.yml"
      - "**/*.md"
```
as it MD action we shall not skip MD files :)

@author:
I'm curious to know why `- ".github/workflows/md-check-links.yml"` is needed.

@user2:
Because you want changes to this file to trigger itself

diff_hunk: @@ -157,7 +157,8 @@ jobs:
       - name: Make Documentation
         working-directory: ./docs/source-${{ matrix.pkg-name }}
         run: |
-          make html --debug --jobs $(nproc) SPHINXOPTS="-W --keep-going"
+          make clean
path: .github/workflows/docs-checks.yml
text: @user1:
```suggestion
```
it shall alwyas start with clean

@author:
Resolved this.