2022-04-23 15:20:11 +00:00
|
|
|
name: Check Markdown links
|
|
|
|
|
|
|
|
on:
|
2022-12-20 06:25:32 +00:00
|
|
|
pull_request:
|
|
|
|
types: [opened, review_requested, reopened]
|
2022-04-23 15:20:11 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
github:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: ubuntu:latest
|
|
|
|
env:
|
|
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v3
|
|
|
|
- run: |
|
2022-04-23 15:47:51 +00:00
|
|
|
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
|
|
|
|
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null
|
|
|
|
apt update
|
2022-08-28 18:22:09 +00:00
|
|
|
apt-get install -y gh jq ca-certificates curl
|
2022-04-23 15:20:11 +00:00
|
|
|
- run: >
|
2022-05-09 17:27:15 +00:00
|
|
|
grep '](https://github.com' README.md [a-z]*.md |
|
2022-04-23 15:20:11 +00:00
|
|
|
sed -re 's/^.*\]\(https:\/\/github.com\/([^\)]*).*/\1/' |
|
2022-08-28 18:22:09 +00:00
|
|
|
xargs -I {} bash -c "echo -n \"{}: \"; gh api repos/{} 2>/dev/null | jq -r '(.archived|tostring)'" | tee archived_check_list.txt
|
2022-04-23 15:20:11 +00:00
|
|
|
env:
|
2022-04-23 15:47:51 +00:00
|
|
|
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
2022-04-23 15:20:11 +00:00
|
|
|
- run: >
|
2022-04-23 16:05:54 +00:00
|
|
|
grep ": true" archived_check_list.txt || true
|
2022-04-23 15:20:11 +00:00
|
|
|
- run: >
|
|
|
|
test $(grep ': true' archived_check_list.txt | wc -l) -le 0
|
2022-08-28 18:22:09 +00:00
|
|
|
- run: >
|
|
|
|
grep ": null" archived_check_list.txt || true
|
|
|
|
- run: >
|
|
|
|
test $(grep ': null' archived_check_list.txt | wc -l) -le 0
|
2022-08-28 10:36:16 +00:00
|
|
|
# curl 429 too many requests
|
|
|
|
# - run: >
|
|
|
|
# grep '](https://github.com' README.md [a-z]*.md |
|
|
|
|
# sed -re 's/^.*\]\(https:\/\/github.com\/([^\)]*).*/\1/' |
|
|
|
|
# xargs -P100 -I {} bash -c "curl -fsSL -o /dev/null https://github.com/{} || echo {} >> removed_check_list.txt"
|
|
|
|
# env:
|
|
|
|
# GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
|
|
|
|
# - run: >
|
|
|
|
# cat removed_check_list.txt
|
|
|
|
# - run: >
|
|
|
|
# test $(cat removed_check_list.txt | wc -l) -le 0
|