You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
2.4 KiB
YAML

name: Check Markdown links
on:
pull_request:
types: [opened, review_requested, reopened]
jobs:
github:
runs-on: ubuntu-latest
container: ubuntu:latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- run: |
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
apt-get install -y gh jq ca-certificates curl
- name: enable problem matcher
run: |
echo "::add-matcher::.github/archive-repo-matcher.json"
- run: |
grep '](https://github.com' [a-z]*.md | sed -re 's/^.*\]\(https:\/\/github.com\/([^\)]*).*/\1/' > /tmp/repos.txt
./.github/scripts/archive_check.sh /tmp/repos.txt archived_check_list.txt
env:
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- run: >
grep ":true\|:null" archived_check_list.txt | cut -d ":" -f 1 | sed 's/^/https:\/\/github.com\//'
- run: >
test $(grep ':true\|:null' archived_check_list.txt | wc -l) -le 0
- run: |
grep '](https://github.com' Archived.md | sed -re 's/^.*\]\(https:\/\/github.com\/([^\)]*).*/\1/' > /tmp/repos_archive.txt
./.github/scripts/archive_check.sh /tmp/repos_archive.txt archive_list.txt
env:
GH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
- run: >
grep ":false" archive_list.txt | cut -d ":" -f 1 | sed 's/^/https:\/\/github.com\//'
- run: >
test $(grep ':false' archive_list.txt | wc -l) -le 0
- name: Disable problem matcher
run: echo "::remove-matcher owner=archive-checker::"
# 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