Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✅ Add link checker #2189

Merged
merged 8 commits into from
Mar 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/pr-check-links.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Check internal links
on:
pull_request:
branches: [main]


jobs:
check-internal-links:
name: Check internal links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: "16"

- name: Install dependencies
run: |
cd docs
npm ci

- name: Check links in Markdown
run: |
cd docs
npm run check-links
71 changes: 71 additions & 0 deletions .github/workflows/scheduled-check-links.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# This is called after the deployed environment is ready to be checked
name: Regularly scheduled check links
on:
schedule:
- cron: "0 2 * * 1,4"

jobs:
check-links:
name: Check links
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
with:
stable: 'true'

- name: Get muffet
env:
MUFFET_VERSION: "2.4.8"
run: wget --quiet -c "https://github.com/raviqqe/muffet/releases/download/v$MUFFET_VERSION/muffet_${MUFFET_VERSION}_Linux_x86_64.tar.gz" -O - | tar -xz

- name: Check links
run: ./muffet --json --buffer-size=8192 --rate-limit=1 --max-connections-per-host=10 --color=always --header="User-Agent:Mozilla/5.0 (Windows NT 10.0) Gecko/20100101 Firefox/91.0" -e=console.platform.sh/projects/create-project -e=cloud.orange-business.com -e=developers.cloudflare.com -e=discord.com -e=pptr.dev https://docs.platform.sh > broken_links.json

- name: Create Markdown file of broken links
if: ${{ always() }}
run: |
data=broken_links.json

# Get length of broken links array
eval "$( jq -r '@sh "urls_length=\(.|length)"' "$data" )"

# Check if any links are broken
if [ -z "$urls_length" ]; then
":tada: There are no broken links! :tada:" > broken_links.md
else
echo -e "The following pages had broken links to check and possibly fix:\n" > broken_links.md

# Loop through the broken URLs to create items
for (( i = 0; i < urls_length; ++i )); do
unset location
unset broken_links
unset error

# Get the location where the broken link was found
eval "$(
jq -r --argjson i "$i" '
.[$i] |
@sh "location=\(.url)"' "$data"
)"
echo "- $location" >> broken_links.md

# Loop through the broken links
jq -r --argjson i "$i" '.[$i] ' "$data" |
# Get the specific broken link and its error
jq -r '.links[] | (.url, .error)' |
while IFS= read -r url ; do
IFS= read -r error
# Output that as a checklist item
echo " - [ ] $error: $url" >> broken_links.md
done
done
fi

- name: Create issue from Markdown file
id: create-issue
if: ${{ always() }}
uses: peter-evans/create-issue-from-file@v2
with:
title: ":bug: Broken links"
content-filepath: broken_links.md
issue-number: 2213
24 changes: 20 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ For how that structure is applied to different types of docs in this project, se

## Table of contents

* [Adding new pages](#adding-new-pages)
* [Adding security reports](#adding-security-reports)
* [Commit messages](#commit-messages)
* [Review process](#review-process)
- [Contributing to the Platform.sh user documentation](#contributing-to-the-platformsh-user-documentation)
- [Table of contents](#table-of-contents)
- [Adding new pages](#adding-new-pages)
- [Adding security reports](#adding-security-reports)
- [Commit messages](#commit-messages)
- [Review process](#review-process)
- [Checks](#checks)

## Adding new pages

Expand Down Expand Up @@ -126,3 +129,16 @@ We generally review for:
To speed the process along, we may merge small changes such as spelling and formatting
into your branch.
Otherwise, we make suggestions and work with you to finalize the changes.

### Checks

To ensure the docs work smoothly, a few checks run on each pull request:

- Vale enforces the [style guidelines](./contributing/content-style.md).
- [Remark](https://remark.js.org/) with the [`remark-validate-links` plugin](https://github.com/remarkjs/remark-validate-links)
checks that all links between Markdown files are valid (including whether linked headers exist).
- Custom workflows [check all changed files](./.github/workflows/get-pr-info.yaml) within `docs/src`
and [comment with links](./.github/workflows/comment-on-pr.yaml) to the deployed pages for easy review.

Outside of pull requests, twice a week [Muffet](https://github.com/raviqqe/muffet)
checks if all links on the site are valid.
10 changes: 10 additions & 0 deletions docs/layouts/shortcodes/clone-commit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Clones and commits

You can clone your codebase by running `platform get <projectID>`
or in your project in the console by going to Code > Git and running the `git clone` command.

When you perform this action, you are actually cloning from your remote integrated repository,
if you have the [appropriate access to do so](/integrations/source/troubleshoot.html).

Your {{ .Get "name" }} repository is considered to be the source of truth for the project.
The project is only a mirror of that repository and all commits should be pushed only to {{ .Get "name" }}.
5 changes: 3 additions & 2 deletions docs/layouts/shortcodes/gen-3-services.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
<th>Supported versions</th>
</tr>
{{- range $image, $info := .Site.Data.registry -}}
{{- if (isset $info "versions-dedicated-gen-3") -}}
{{- if and (isset $info "versions-dedicated-gen-3") (ne $image "redis-persistent") -}}
{{- $label := index $info "name" -}}
{{- $versions := index ( index $info "versions-dedicated-gen-3") "supported" -}}
{{- $docs_link := index (index $info "docs") "url" -}}
<tr>
<td><a href="/configuration/services/{{ $image }}.html">{{ $label }}</a></td>
<td><a href="{{ $docs_link }}">{{ $label }}</a></td>
<td>
{{- $service_versions := "" -}}
{{- range $versions -}}
Expand Down
7 changes: 6 additions & 1 deletion docs/layouts/shortcodes/guides/gatsby/headless-backend.html
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
<p>There has only been a single modification to Platform.sh&rsquo;s <a href="https://github.com/platformsh-templates/{{ anchorize ( .Get "name" ) }}" target="_blank" rel="noopener">standard {{ .Get "name" }} template</a> configuration in the multi-app template: the <code>name</code> attibribute in {{ .Get "name" }}&rsquo;s <code>.platform.app.yaml</code> has been updated to <code>{{ anchorize ( .Get "name" )}}</code>. You will notice this value used when the <code>relationship</code> between Gatsby and {{ .Get "name" }} is defined <a href="#gatsby">below for Gatsby</a> and in the <a href="#platformroutesyaml">routes</a> configuration above.</p>
{{ $name := .Get "name" }}
trolologuy marked this conversation as resolved.
Show resolved Hide resolved
{{ $template := $name }}
{{ if eq $name "Drupal" }}
{{ $template = "Drupal9"}}
{{ end }}
<p>There has only been a single modification to Platform.sh&rsquo;s <a href="https://github.com/platformsh-templates/{{ anchorize ( $template ) }}" target="_blank" rel="noopener">standard {{ $name }} template</a> configuration in the multi-app template: the <code>name</code> attibribute in {{ $name }}&rsquo;s <code>.platform.app.yaml</code> has been updated to <code>{{ anchorize ( $name )}}</code>. You will notice this value used when the <code>relationship</code> between Gatsby and {{ $name }} is defined <a href="#gatsby">below for Gatsby</a> and in the <a href="#platformroutesyaml">routes</a> configuration above.</p>
2 changes: 1 addition & 1 deletion docs/layouts/shortcodes/guides/gatsby/headless-gatsby.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</li>
<li>
<p><code>post_deploy</code></p>
<p>Platform.sh containers reside in separate build containers at build time, before their images are moved to the final application container at deploy time. These build containers are isolated, and therefore Gatsby does not have access to {{ .Get "name" }} during the build hook, where you would normally run <a href="https://github.com/platformsh-templates/gatsby/blob/master/.platform.app.yaml#L21" target="_blank" rel="noopener"><code>gatsby build</code></a>. {{ .Get "name" }} will not be available until after the deploy hook, and so Gatsby&rsquo;s build is postponed until the <a href="/configuration/app/hooks.html#post-deploy-hook"><code>post_deploy</code></a> hook below.</p>
<p>Platform.sh containers reside in separate build containers at build time, before their images are moved to the final application container at deploy time. These build containers are isolated, and therefore Gatsby does not have access to {{ .Get "name" }} during the build hook, where you would normally run <a href="https://github.com/platformsh-templates/gatsby/blob/master/.platform.app.yaml#L21" target="_blank" rel="noopener"><code>gatsby build</code></a>. {{ .Get "name" }} will not be available until after the deploy hook, and so Gatsby&rsquo;s build is postponed until the <a href="/configuration/app/hooks/hooks-comparison.html#post-deploy-hook"><code>post_deploy</code></a> hook below.</p>
</li>
<li>
<p><code>mounts</code></p>
Expand Down
4 changes: 2 additions & 2 deletions docs/layouts/shortcodes/guides/lando.html
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<p><a href="https://github.com/lando/lando" target="_blank" rel="noopener">Lando</a> is Platform.sh&rsquo;s recommended local development tool. Lando can read your Platform.sh configuration files for Wordpress and produce an approximately equivalent configuration using Docker with minimal effort. See the <a href="https://docs.lando.dev/config/platformsh.html" target="_blank" rel="noopener">Lando documentation</a> for installing and setting up Lando on your system.</p>
<p><a href="https://github.com/lando/lando" target="_blank" rel="noopener">Lando</a> is Platform.sh&rsquo;s recommended local development tool. Lando can read your Platform.sh configuration files for Wordpress and produce an approximately equivalent configuration using Docker with minimal effort. See the <a href="https://docs.lando.dev/platformsh/" target="_blank" rel="noopener">Lando documentation</a> for installing and setting up Lando on your system.</p>
<p>Templates come configured for use already with a base <a href="https://docs.lando.dev/config/lando.html" target="_blank" rel="noopener">Landofile</a> shown below, which can be helpful getting started with Lando without the need to have a project on Platform.sh. This file sets up good defaults for Lando and Platform.sh-configured codebases, most notably through the <code>recipe</code> attribute.</p>

{{ $file := printf "static/files/fetch/lando/%s" (.Get "repo" ) }}
{{ highlight ( readFile $file ) "yaml" ""}}

<p>This Landofile is also the place where you can configure access to tools that would normally be available within a Platform.sh app container (such as the WordPress CLI), that you would also want access to locally.</p>

<p>You can replicate this file, or otherwise follow the directions in the <a href="https://docs.lando.dev/config/platformsh.html#getting-started" target="_blank" rel="noopener">Lando documentation for Platform.sh</a> to setup the repository locally. Once you have completed the configuration, you can then start to local environment by running:</p>
<p>You can replicate this file, or otherwise follow the directions in the <a href="https://docs.lando.dev/platformsh/getting-started.html" target="_blank" rel="noopener">Lando documentation for Platform.sh</a> to setup the repository locally. Once you have completed the configuration, you can then start to local environment by running:</p>
<div class="highlight"><pre class="chroma"><code class="language-bash" data-lang="bash">$ lando start
</code></pre></div>
2 changes: 1 addition & 1 deletion docs/layouts/shortcodes/language-specification.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{ $type := .Get "type" }}
### Specify the language

To use {{ .Get "display_name" }}, specify `{{ $type }}` as your [app's `type`](/configuration/app/app-reference.html#type):
To use {{ .Get "display_name" }}, specify `{{ $type }}` as your [app's `type`](/configuration/app/app-reference.html#types):

<!-- vale off -->
<div class="highlight-location">.platform.app.yaml</div>
Expand Down
2 changes: 2 additions & 0 deletions docs/layouts/shortcodes/spring-common-props.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
For access to more credentials options, check [Spring common application properties](https://docs.spring.io/spring-boot/docs/current/reference/html/application-properties.html)
and [binding from environment variables](https://docs.spring.io/spring-boot/docs/current/reference/html/spring-boot-features.html#features.external-config.typesafe-configuration-properties.relaxed-binding.environment-variables).
Loading