Skip to content

Commit

Permalink
Add Github Action to check for broken site links (#1393)
Browse files Browse the repository at this point in the history
* Add URL check for live site

* Fix node structure.

* Update linkcheck action ref.

* Test servedocs in GHA.

* Run servedocs in parallel

* Fix broken catalog link.

* Remove ampersand.

* Change args param.

* Lower wait time.

* Add timer to building.

* Temporarily remove site wait.

* Use pub in ubuntu-latest.

* Add dart setup.

* Use pub executable path.

* Extend site build time.

* Switch to building manually.

* Add working directory.

* Remove unreal build command.

* Change python path.

* Move doc content to docs/kpt

* Copy docs to new dir.

* Copy to built site dire.

* First pass of broken links.

* Fix remaining 404s.

* Fix 404s.

* Regen docs.

* Clean up GHA.

* Avoid two redirects.
  • Loading branch information
etefera committed Feb 2, 2021
1 parent 8af1eae commit 8be3f71
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 5 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/sitecheck.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright 2021 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: SiteCheck
on:
pull_request:
branches:
- master
paths:
- "site/**"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: cedx/setup-dart@v2
- uses: actions/checkout@v2
- name: Build site
run: |
pub global activate linkcheck
go run github.com/gohugoio/hugo
working-directory: ./site
- name: Copy site content
run: |
mkdir built-site && mkdir built-site/kpt
cd docs
cp -r . ../built-site/kpt
- name: Crawl site
run: |
python -m SimpleHTTPServer 1313 & sleep 5s
$HOME/.pub-cache/bin/linkcheck localhost:1313/kpt
working-directory: ./built-site
4 changes: 2 additions & 2 deletions site/content/en/concepts/functions/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ pipeline. Get detailed tutorials on how to use `kpt fn export` from the
- Learn more ways of using the `kpt fn` command from the [reference] doc.

[architecture influences]: ../architecture/#influences
[sources catalog]: ../../guides/consumer/function/sources
[sinks catalog]: ../../guides/consumer/function/catalog/sinks
[sources catalog]: ../../guides/consumer/function/catalog/sources/
[sinks catalog]: ../../guides/consumer/function/catalog/sinks/
[spec]: https://github.com/kubernetes-sigs/kustomize/blob/master/cmd/config/docs/api-conventions/functions-spec.md
[Export a Workflow]: ../../guides/consumer/function/export/
[function producer docs]: ../../guides/producer/functions/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,6 @@ ${tableByType(name.toLowerCase())}
- Learn more ways of using the kpt fn command from the [reference] doc.
[reference]: ../../../../reference/fn/run/`;
[reference]: ../../../../../reference/fn/run/`;

console.log(README);
2 changes: 1 addition & 1 deletion site/content/en/reference/fn/sink/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ DIR:
[sink function]: ../../../concepts/functions/#sink-function
[functions concepts]: ../../../concepts/functions/
[catalog]: ../../../guides/consumer/function/catalog/sinks
[catalog]: ../../../guides/consumer/function/catalog/sinks/
2 changes: 1 addition & 1 deletion site/content/en/reference/fn/source/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ DIR:
[source function]: ../../../concepts/functions/#source-function
[functions concepts]: ../../../concepts/functions/
[catalog]: ../../../guides/consumer/function/catalog/sources
[catalog]: ../../../guides/consumer/function/catalog/sources/

0 comments on commit 8be3f71

Please sign in to comment.