정적 파일이나 웹 페이지에서 깨진 링크를 확인하는 GitHub 작업입니다. 머플은 URL 검사 작업에 사용됩니다.
mkdocs.org에 대해 주기적 검사 (주간)를 실행하려면 기본 Github 조치 예제를 참조하십시오.
on :
schedule :
- cron : ' 0 0 * * 0 '
name : Check markdown links
jobs :
my-broken-link-checker :
name : Check broken links
runs-on : ubuntu-latest
steps :
- name : Check
uses : ruzickap/action-my-broken-link-checker@v2
with :
url : https://www.mkdocs.org
cmd_params : " --one-page-only --max-connections=3 --color=always " # Check just one page실제 데모를 확인하십시오.
이 배포 동작은 정적 사이트 생성기 (Hugo, MKDocs, Gatsby, Gitbook, MDBook 등)와 결합 할 수 있습니다. 다음 예제는 웹 페이지에 ./build 디렉토리에 저장 될 것으로 예상됩니다. 테스트 중에 URL 매개 변수의 호스트 이름을 사용하고 웹 페이지를 제공하는 캐디 웹 서버가 시작되었습니다 (EntryPoint.sh의 세부 사항 참조).
- name : Check
uses : ruzickap/action-my-broken-link-checker@v2
with :
url : https://www.example.com/test123
pages_path : ./build/
cmd_params : ' --buffer-size=8192 --max-connections=10 --color=always --skip-tls-verification --header="User-Agent:curl/7.54.0" --timeout=20 ' # muffet parametersDocker 빌드 단계를 건너 뛰고 싶습니까? 자, 스크립트 모드도 사용할 수 있습니다.
- name : Check
env :
INPUT_URL : https://www.example.com/test123
INPUT_PAGES_PATH : ./build/
INPUT_CMD_PARAMS : ' --buffer-size=8192 --max-connections=10 --color=always --header="User-Agent:curl/7.54.0" --skip-tls-verification ' # --skip-tls-verification is mandatory parameter when using https and "PAGES_PATH"
run : wget -qO- https://raw.githubusercontent.com/ruzickap/action-my-broken-link-checker/v2/entrypoint.sh | bash ./entrypoint.sh 스크립트가 사용하는 환경 변수.
| 변하기 쉬운 | 기본 | 설명 |
|---|---|---|
INPUT_CMD_PARAMS | --buffer-size=8192 --max-connections=10 --color=always --verbose | URL 체커 머플의 명령 줄 매개 변수 |
INPUT_DEBUG | 거짓 | ./entrypoint.sh 스크립트에 대한 디버그 모드 활성화 ( set -x ) |
INPUT_PAGES_PATH | 로컬 웹 페이지와 함께 디렉토리의 상대 경로 | |
INPUT_URL | ( 필수 / 필수 ) | 확인 될 URL |
주기 링크 점검을위한 파이프 라인 :
name : periodic-broken-link-checks
on :
workflow_dispatch :
push :
paths :
- .github/workflows/periodic-broken-link-checks.yml
schedule :
- cron : ' 3 3 * * 3 '
jobs :
broken-link-checker :
runs-on : ubuntu-latest
steps :
- name : Setup Pages
id : pages
uses : actions/configure-pages@v3
- name : Check broken links
uses : ruzickap/action-my-broken-link-checker@v2
with :
url : ${{ steps.pages.outputs.base_url }}
cmd_params : ' --buffer-size=8192 --max-connections=10 --color=always --header="User-Agent:curl/7.54.0" --timeout=20 ' GitHub 액션 예 :
name : Checks
on :
push :
branches :
- main
jobs :
build-deploy :
runs-on : ubuntu-latest
steps :
- name : Create web page
run : |
mkdir -v public
cat > public/index.html << EOF
<!DOCTYPE html>
<html>
<head>
My page which will be stored on my-testing-domain.com domain
</head>
<body>
Links:
<ul>
<li><a href="https://my-testing-domain.com">https://my-testing-domain.com</a></li>
<li><a href="https://my-testing-domain.com:443">https://my-testing-domain.com:443</a></li>
</ul>
</body>
</html>
EOF
- name : Check links using script
env :
INPUT_URL : https://my-testing-domain.com
INPUT_PAGES_PATH : ./public/
INPUT_CMD_PARAMS : ' --skip-tls-verification --verbose --color=always '
INPUT_DEBUG : true
run : wget -qO- https://raw.githubusercontent.com/ruzickap/action-my-broken-link-checker/v2/entrypoint.sh | bash
- name : Check links using container
uses : ruzickap/action-my-broken-link-checker@v2
with :
url : https://my-testing-domain.com
pages_path : ./public/
cmd_params : ' --skip-tls-verification --verbose --color=always '
debug : true 웹 페이지 작성을 가능한 한 자동화 해 보겠습니다.
이상적인 상황에는 저장소 명명 규칙이 필요하며 GitHub 저장소의 이름이 호스팅 될 URL과 일치해야합니다.
필수 부분은 도메인과 동일한 저장소 이름 awsug.cz 입니다.
웹 페이지는 자체 도메인의 github 페이지로 저장됩니다.
GH 조치 파일은 다음과 같습니다.
name : hugo-build
on :
pull_request :
types : [opened, synchronize]
push :
jobs :
hugo-build :
runs-on : ubuntu-latest
steps :
- uses : actions/checkout@v2
- name : Checkout submodules
shell : bash
run : |
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name : Setup Hugo
uses : peaceiris/actions-hugo@v2
with :
hugo-version : ' 0.62.0 '
- name : Build
run : |
hugo --gc
cp LICENSE README.md public/
echo "${{ github.event.repository.name }}" > public/CNAME
- name : Check broken links
env :
INPUT_URL : https://${{ github.event.repository.name }}
INPUT_PAGES_PATH : public
INPUT_CMD_PARAMS : ' --verbose --buffer-size=8192 --max-connections=10 --color=always --skip-tls-verification --exclude="(mylabs.dev|linkedin.com)" '
run : |
wget -qO- https://raw.githubusercontent.com/ruzickap/action-my-broken-link-checker/v2/entrypoint.sh | bash
- name : Check links using container
uses : ruzickap/action-my-broken-link-checker@v2
with :
url : https://my-testing-domain.com
pages_path : ./public/
cmd_params : ' --verbose --buffer-size=8192 --max-connections=10 --color=always --skip-tls-verification --header="User-Agent:curl/7.54.0" --exclude="(mylabs.dev|linkedin.com)" '
debug : true
- name : Deploy
uses : peaceiris/actions-gh-pages@v3
if : ${{ github.event_name }} == 'push' && github.ref == 'refs/heads/main'
env :
ACTIONS_DEPLOY_KEY : ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH : gh-pages
PUBLISH_DIR : public
with :
forceOrphan : true그 예는 Hugo를 사용하는 것입니다.
필수 부분은 ruzickap.github.io 의 디렉토리 부분 인 저장소 이름 k8s-harbor 입니다.
예에서 웹 페이지는 Github의 도메인 github.io를 사용합니다.
name : vuepress-build-check-deploy
on :
pull_request :
types : [opened, synchronize]
paths :
- .github/workflows/vuepress-build-check-deploy.yml
- docs/**
- package.json
- package-lock.json
push :
paths :
- .github/workflows/vuepress-build-check-deploy.yml
- docs/**
- package.json
- package-lock.json
jobs :
vuepress-build-check-deploy :
runs-on : ubuntu-latest
steps :
- uses : actions/checkout@v2
- name : Install Node.js 12
uses : actions/setup-node@v1
with :
node-version : 12.x
- name : Install VuePress and build the document
run : |
npm install
npm run build
cp LICENSE docs/.vuepress/dist
sed -e "s@(part-@(https://github.com/${GITHUB_REPOSITORY}/tree/main/docs/part-@" -e 's@./.vuepress/public/@./@' docs/README.md > docs/.vuepress/dist/README.md
ln -s docs/.vuepress/dist ${{ github.event.repository.name }}
- name : Check broken links
uses : ruzickap/action-my-broken-link-checker@v2
with :
url : https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}
pages_path : .
cmd_params : ' --exclude=mylabs.dev --max-connections-per-host=5 --rate-limit=5 --timeout=20 --header="User-Agent:curl/7.54.0" --skip-tls-verification '
- name : Deploy
uses : peaceiris/actions-gh-pages@v3
if : ${{ github.event_name }} == 'push' && github.ref == 'refs/heads/main'
env :
ACTIONS_DEPLOY_KEY : ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH : gh-pages
PUBLISH_DIR : ./docs/.vuepress/dist
with :
forceOrphan : true이 경우 VuePress를 사용하여 페이지를 만듭니다.
디스크에 로컬로 저장된 웹 페이지를 확인할 때 또 다른 예. 이 경우이 git 저장소에서 ./tests/ 디렉토리에 생성 된 웹 페이지를 사용하고 있습니다.
export INPUT_URL= " https://my-testing-domain.com "
export INPUT_PAGES_PATH= " ${PWD} /tests/ "
export INPUT_CMD_PARAMS= " --skip-tls-verification --verbose --color=always "
./entrypoint.sh산출:
*** INFO: Using path "/home/pruzicka/git/action-my-broken-link-checker/tests/" as domain "my-testing-domain.com" with URI "https://my-testing-domain.com"
*** INFO: [2019-12-30 14:54:22] Start checking: "https://my-testing-domain.com"
https://my-testing-domain.com/
200 https://my-testing-domain.com
200 https://my-testing-domain.com/run_tests.sh
200 https://my-testing-domain.com:443
200 https://my-testing-domain.com:443/run_tests.sh
https://my-testing-domain.com:443/
200 https://my-testing-domain.com
200 https://my-testing-domain.com/run_tests.sh
200 https://my-testing-domain.com:443
200 https://my-testing-domain.com:443/run_tests.sh
*** INFO: [2019-12-30 14:54:22] Checks completed...
정적 사이트 생성기 및 github 작업을 사용하여 웹 페이지를 구축하고 확인하는 다른 예는 여기에서 찾을 수 있습니다 : https://github.com/peaceiris/actions-gh-pages/
다음 링크에는 깨진 링크 검사기의 실제 예제가 포함되어 있습니다.
휴고 건물
vuepress-build-check deploy
주기적 파괴 링크-점검