🔗 检查链接 #56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 🔗 检查链接 | |
on: | |
workflow_dispatch: | |
workflow_call: | |
schedule: | |
- cron: "00 16 * * 1" | |
jobs: | |
linkChecker: | |
runs-on: ubuntu-latest | |
if: github.repository == 'xiaoxuan6/github-mirror' | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-go@v2 | |
with: | |
go-version: '1.20' | |
- name: generate links.md | |
env: | |
key: ${{ secrets.key }} | |
KV_URL: ${{ secrets.KV_URL }} | |
run: | | |
go run generate_md.go | |
- name: Link Checker | |
id: lychee | |
uses: lycheeverse/[email protected] | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
with: | |
args: >- | |
--verbose | |
--no-progress | |
--user-agent 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36' | |
'Links.md' | |
- name: Create Issue From File | |
if: env.lychee_exit_code != 0 | |
uses: peter-evans/create-issue-from-file@v4 | |
with: | |
title: 🔗 链接检查报告 | |
content-filepath: ./lychee/out.md | |
labels: report | |
- name: check fail url and resync kv | |
if: success() | |
env: | |
key: ${{ secrets.key }} | |
KV_URL: ${{ secrets.KV_URL }} | |
run: | | |
echo $(cat lychee/out.md | awk '/\* \[/ {print $3}' | sort -u | sed -e 's|\[||g' -e 's|\].*||g' -e 's|http://||g' | tr -d '/') | |
cat lychee/out.md | awk '/\* \[/ {print $3}' | sort -u | sed -e 's|\[||g' -e 's|\].*||g' -e 's|http://||g' | tr -d '/' | xargs echo > out.md | |
go run resync.go |