Skip to content

Commit

Permalink
check-links added to repo (#1559)
Browse files Browse the repository at this point in the history
* check-links added

* Review

* Dotnet changes removed

* Delete dotnet/sample-apps/aws-sdk/wrapper/SampleApps/AwsSdkSample/obj/Debug/net6.0 directory

Unwanted

* Undo deleted AwsSdkSample.sln
  • Loading branch information
RichardChukwu authored Nov 4, 2024
1 parent 6151af2 commit a7b5001
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/check-links.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: check-links
on:
push:
branches: [main]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
jobs:
changedfiles:
name: changed files
runs-on: ubuntu-latest
env:
PR_HEAD: ${{ github.event.pull_request.head.sha }}
outputs:
md: ${{ steps.changes.outputs.md }}
steps:
- name: Checkout Repo
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0
- name: Get changed files
id: changes
run: |
echo "md=$(git diff --name-only --diff-filter=ACMRTUXB $(git merge-base origin/main $PR_HEAD) $PR_HEAD | grep .md$ | xargs)" >> $GITHUB_OUTPUT
check-links:
runs-on: ubuntu-latest
needs: changedfiles
if: ${{needs.changedfiles.outputs.md}}
steps:
- name: Checkout Repo
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
with:
fetch-depth: 0

- name: Install markdown-link-check
run: npm install

- name: Run markdown-link-check
run: |
npx --no -- markdown-link-check \
--verbose \
--config .github/workflows/check_links_config.json \
${{needs.changedfiles.outputs.md}} \
|| { echo "Check that anchor links are lowercase"; exit 1; }
28 changes: 28 additions & 0 deletions .github/workflows/check_links_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"ignorePatterns": [
{
"pattern": "http(s)?://\\d+\\.\\d+\\.\\d+\\.\\d+"
},
{
"pattern": "http(s)?://localhost"
},
{
"pattern": "http(s)?://example.com"
},
{
"pattern": "https://docs.aws.amazon.com"
},
{
"pattern": "https://console.aws.amazon.com"
}
],
"aliveStatusCodes": [429, 200],
"httpHeaders": [
{
"urls": ["https://docs.aws.amazon.com", "https://docs.github.com/"],
"headers": {
"Accept-Encoding": "zstd, br, gzip, deflate"
}
}
]
}

0 comments on commit a7b5001

Please sign in to comment.