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 check-external-links command #4235

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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/actions/build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Install

runs:
using: composite

steps:
- name: Cache build
uses: actions/[email protected]
id: build-cache

with:
# Use faster GNU tar for all runners
enableCrossOsArchive: true

# Restore build cache (unless commit SHA changes)
key: build-${{ runner.os }}-${{ github.sha }}
path: build

- name: Build
id: build

# Skip build when we’ve built this SHA before
if: steps.build-cache.outputs.cache-hit != 'true'
shell: bash

run: npm run build
33 changes: 33 additions & 0 deletions .github/workflows/actions/install-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Install dependencies

runs:
using: composite

steps:
- name: Cache dependencies
uses: actions/[email protected]
id: npm-install-cache

with:
# Use faster GNU tar for all runners
enableCrossOsArchive: true

# Restore `node_modules` cache (unless packages change)
key: npm-install-${{ runner.os }}-${{ hashFiles('package-lock.json', '**/package.json') }}
path: node_modules

- name: Setup Node.js
uses: ./.github/workflows/actions/setup-node
id: setup-node

with:
# Restore global `~/.npm` cache (unless packages change)
use-cache: ${{ steps.npm-install-cache.outputs.cache-hit != 'true' }}

- name: Install dependencies
id: install-node

# Skip install when dependencies are cached
if: steps.npm-install-cache.outputs.cache-hit != 'true'
shell: bash
run: npm ci
19 changes: 19 additions & 0 deletions .github/workflows/actions/setup-node/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Setup

inputs:
use-cache:
description: Restore global `~/.npm` cache
default: 'true'
required: true

runs:
using: composite

steps:
- name: Setup Node.js
uses: actions/[email protected]
id: setup-node

with:
cache: ${{ inputs.use-cache == 'true' && 'npm' || '' }}
node-version-file: .nvmrc
30 changes: 30 additions & 0 deletions .github/workflows/check-external-links.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Check external links

on:
pull_request:

push:
branches:
- 'feature/**'
- 'v[0-9]'

workflow_dispatch:

jobs:
check-links:
name: Check for broken external links
runs-on: 'ubuntu-latest'

steps:
- name: Checkout
uses: actions/[email protected]

- name: Install dependencies
uses: ./.github/workflows/actions/install-node

- name: Build
uses: ./.github/workflows/actions/build

- name: Check external broken links
id: check-links
run: npm run check-external-links
41 changes: 6 additions & 35 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,30 +28,11 @@ jobs:
- name: Checkout code
uses: actions/[email protected]

- name: Restore build
uses: actions/[email protected]
id: build-cache

with:
key: build-cache-${{ runner.os }}-${{ github.sha }}
path: build

- name: Setup Node.js
uses: actions/[email protected]
if: steps.build-cache.outputs.cache-hit != 'true'

with:
cache: npm
check-latest: true
node-version-file: .nvmrc

- name: Install dependencies
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm ci
uses: ./.github/workflows/actions/install-node

- name: Build
if: steps.build-cache.outputs.cache-hit != 'true'
run: npm run build
- name: Build website
uses: ./.github/workflows/actions/build

test:
name: ${{ matrix.task.description }}
Expand Down Expand Up @@ -91,21 +72,11 @@ jobs:
- name: Checkout
uses: actions/[email protected]

- name: Setup Node.js
uses: actions/[email protected]
with:
cache: npm
check-latest: true
node-version-file: .nvmrc

- name: Install dependencies
run: npm ci
uses: ./.github/workflows/actions/install-node

- name: Restore build
uses: actions/cache/[email protected]
with:
key: build-cache-${{ runner.os }}-${{ github.sha }}
path: build
- name: Build
uses: ./.github/workflows/actions/build

- name: Run task
id: task
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
build/
/build/
node_modules/
*.log
.DS_Store
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"lint:scss:cli": "stylelint --cache --cache-location .cache/stylelint --cache-strategy content --color --ignore-path .gitignore --max-warnings 0",
"lint:types": "tsc --build tsconfig.json",
"check-links": "hyperlink --canonicalroot https://design-system.service.gov.uk/ --internal --recursive build/sitemap.xml | tee check-links.log | tap-mocha-reporter min",
"check-external-links": "hyperlink --canonicalroot https://design-system.service.gov.uk/ build/sitemap.xml --recursive --skip \"github.com\" | tee check-links.log | tap-mocha-reporter min",
"prepare": "node -e \"try { (await import('husky')).default() } catch (e) { if (e.code !== 'ERR_MODULE_NOT_FOUND') throw e }\" --input-type module"
},
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions src/accessibility-statement.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ DAC also tested the global search functionality that appears in the header of th

### Frontend documentation website

The [GOV.UK Frontend documentation website](http://frontend.design-system.service.gov.uk/) was last audited for accessibility issues by an external group in April 2021. The audit was carried out by the [Digital Accessibility Centre (DAC)](https://digitalaccessibilitycentre.org/).
The [GOV.UK Frontend documentation website](https://frontend.design-system.service.gov.uk/) was last audited for accessibility issues by an external group in April 2021. The audit was carried out by the [Digital Accessibility Centre (DAC)](https://digitalaccessibilitycentre.org/).

DAC tested the [Technical Documentation Template](https://tdt-documentation.london.cloudapps.digital/), which is the template for the GOV.UK Frontend documentation website.
DAC tested the [Technical Documentation Template](https://github.com/alphagov/tdt-documentation/), which is the template for the GOV.UK Frontend documentation website.

To learn more, read the [Accessibility statement for Technical Documentation Template and documentation](https://github.com/alphagov/tdt-documentation/blob/main/source/accessibility/index.html.md.erb).

Expand Down
2 changes: 1 addition & 1 deletion src/accessibility/accessibility-strategy/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ The team also uses general inspection techniques, including:

The team currently uses [jest-axe](https://github.com/nickcolley/jest-axe) as part of our deployment process, along with [@axe-core/puppeteer](https://github.com/dequelabs/axe-core-npm/blob/develop/packages/puppeteer). These tools test the example code snippets in the GOV.UK Design System against [axe-core](https://github.com/dequelabs/axe-core).

The team does not solely rely on automated testing processes, as a 2017 study from GDS concluded that [only about 30% of issues are found by automated testing tools](https://accessibility.blog.gov.uk/2017/02/24/what-we-found-when-we-tested-tools-on-the-worlds-least-accessible-webpage), such as axe-core.
The team does not solely rely on automated testing processes, as a 2017 study from GDS concluded that [only about 30% of issues are found by automated testing tools](https://accessibility.blog.gov.uk/2017/02/24/what-we-found-when-we-tested-tools-on-the-worlds-least-accessible-webpage/), such as axe-core.

As of May 2023, we have improved our automated accessibility testing processes:

Expand Down
2 changes: 1 addition & 1 deletion src/code-of-conduct.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ List of organisers:
- Steve Messer
- Tallulah Jackson-Marriott

(These guidelines are adapted from the [Practical Service Design](http://www.practicalservicedesign.com/getting-started-on-slack/) community guidelines, [Afrotech Fest](https://www.afrotechfest.co.uk/coc/), [Code for America](http://www.cvent.com/events/code-for-america-summit-2018/custom-40-e12d85b157b94d69b80d8911cc641d36.aspx), [UKGovcamp](https://www.ukgovcamp.com/code-of-conduct/), and [Services Week 2021](https://docs.google.com/document/d/1vQchJh-s6Fu6F4bN8UFM4lvRChe8ERgsE5whf9pUfjA/edit?usp=sharing) codes of conduct.)
(These guidelines are adapted from [Afrotech Fest](https://www.afrotechfest.co.uk/coc/), [Code for America](http://www.cvent.com/events/code-for-america-summit-2018/custom-40-e12d85b157b94d69b80d8911cc641d36.aspx), [UKGovcamp](https://www.ukgovcamp.com/code-of-conduct/), and [Services Week 2021](https://docs.google.com/document/d/1vQchJh-s6Fu6F4bN8UFM4lvRChe8ERgsE5whf9pUfjA/edit?usp=sharing) codes of conduct.)
owenatgov marked this conversation as resolved.
Show resolved Hide resolved

---

Expand Down
2 changes: 1 addition & 1 deletion src/community/code-of-conduct/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ List of organisers:
- Romaric Pascal
- Trang Erskine

(These guidelines are adapted from the [Practical Service Design](http://www.practicalservicedesign.com/getting-started-on-slack/) community guidelines, [Afrotech Fest code of conduct](https://www.afrotechfest.co.uk/coc/), [Code for America code of conduct](http://www.cvent.com/events/code-for-america-summit-2018/custom-40-e12d85b157b94d69b80d8911cc641d36.aspx), [UKGovcamp code of conduct](https://www.ukgovcamp.com/code-of-conduct/), and [Services Week 2021 code of conduct](https://docs.google.com/document/d/1vQchJh-s6Fu6F4bN8UFM4lvRChe8ERgsE5whf9pUfjA/edit?usp=sharing) codes of conduct.)
(These guidelines are adapted from [Afrotech Fest code of conduct](https://www.afrotechfest.co.uk/coc/), [Code for America code of conduct](http://www.cvent.com/events/code-for-america-summit-2018/custom-40-e12d85b157b94d69b80d8911cc641d36.aspx), [UKGovcamp code of conduct](https://www.ukgovcamp.com/code-of-conduct/), and [Services Week 2021 code of conduct](https://docs.google.com/document/d/1vQchJh-s6Fu6F4bN8UFM4lvRChe8ERgsE5whf9pUfjA/edit?usp=sharing) codes of conduct.)
4 changes: 2 additions & 2 deletions src/community/contribution-criteria/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Before a new component or pattern is published the working group reviews the imp
},
{
html: '<p>It reuses existing styles and components in the Design System where relevant.</p>
<p>Both the guidance and any content included in examples must follow the <a href="https://www.gov.uk/guidance/style-guide/a-to-z-of-gov-uk-style">GOV.UK content style guide</a>.</p>
<p>Both the guidance and any content included in examples must follow the <a href="https://www.gov.uk/guidance/style-guide/a-to-z">GOV.UK content style guide</a>.</p>
<p class="govuk-!-margin-bottom-0">If there is code, it follows the <a href="https://github.com/alphagov/govuk-frontend/blob/main/CONTRIBUTING.md#conventions-to-follow">GOV.UK Frontend coding standards</a> and is ready to merge in GOV.UK Frontend.</p>'
}
],
Expand Down Expand Up @@ -116,7 +116,7 @@ Before linking from the Design System to a [community resource or tool](/communi
- design resources are consistent with the styles, components and patterns in the GOV.UK Design System
- development resources output the same markup as GOV.UK Frontend
- it is not being charged for or used to promote a private business
- it's compatible with the [Service Standard](https://www.gov.uk/service-manual/service-standard) and [Technology code of practice](https://www.gov.uk/government/publications/technology-code-of-practice/technology-code-of-practice)
- it's compatible with the [Service Standard](https://www.gov.uk/service-manual/service-standard) and [Technology code of practice](https://www.gov.uk/guidance/the-technology-code-of-practice)

To help users decide whether to use your resource or tool and tell them how to get support for it, add this message to the resource README and after any website links:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Sam is the Head of Design in Digital Transformation, Digital Directorate, Scotti

### Jennifer I'Anson (Scottish Government)

Jennifer is a lead product manager within the Digital directorate of the Scottish Government responsible for [mygov.scot](https://mygov.scot) and [gov.scot](https://gov.scot). She is also Product Owner of the Scottish Government’s Design System from its inception, helping launch it during the pandemic.
Jennifer is a lead product manager within the Digital directorate of the Scottish Government responsible for [mygov.scot](https://www.mygov.scot) and [gov.scot](https://www.gov.scot). She is also Product Owner of the Scottish Government’s Design System from its inception, helping launch it during the pandemic.

### GOV.UK Design System team

Expand Down
2 changes: 1 addition & 1 deletion src/community/develop-a-component-or-pattern/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The following principles will help you research and develop your contribution.

### Start with what exists

Find examples of the component or pattern already in use. The best way to do this is to ask the government design community on the [digital service designers mailing list](https://groups.google.com/a/digital.cabinet-office.gov.uk/forum/?hl=en-GB#!forum/digital-service-designers) or the [#design channel on cross-government Slack](https://ukgovernmentdigital.slack.com/app_redirect?channel=design).
Find examples of the component or pattern already in use. The best way to do this is to ask the government design community on the [digital service designers mailing list](https://groups.google.com/a/digital.cabinet-office.gov.uk/g/digital-service-designers) or the [#design channel on cross-government Slack](https://ukgovernmentdigital.slack.com/app_redirect?channel=design).

Examples and research from government services are usually most relevant. But look at how other organisations solve the problem too.

Expand Down
2 changes: 1 addition & 1 deletion src/components/exit-this-page/secondary-link/index.njk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ layout: layout-example.njk

{{ govukSkipLink({
text: "Exit this page",
href: "https://bbc.co.uk/weather/",
href: "https://www.bbc.co.uk/weather",
classes: "govuk-js-exit-this-page-skiplink",
attributes: {
"rel": "nofollow noreferrer"
Expand Down
2 changes: 1 addition & 1 deletion src/components/footer/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Make it clear whether content is available for re-use - and if it is, under what
You can add links to:

- [your service's privacy notice](https://www.gov.uk/service-manual/design/collecting-personal-information-from-users)
- [your service's accessibility statement](https://www.gov.uk/service-manual/helping-people-to-use-your-service/publishing-information-about-your-services-accessibility)
- [your service's accessibility statement](https://www.gov.uk/guidance/make-your-website-or-app-accessible-and-publish-an-accessibility-statement)
- [your service's Cookies page](/patterns/cookies-page/)
- terms and conditions
- other language options
Expand Down
2 changes: 1 addition & 1 deletion src/components/password-input/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Some browsers might automatically change what the user is typing when the input

You can tell browsers not to correct spellings by setting the `spellcheck` attribute to `false`.

Doing this can also prevent ['spell-jacking'](https://www.otto-js.com/news/article/chrome-and-edge-enhanced-spellcheck-features-expose-pii-even-your-passwords), where security researchers have found some spell checking tools gathering personal identifiable information, even user’s passwords, from password input fields to send to third party services.
Doing this can also prevent ['spell-jacking'](https://www.itpro.com/security/vulnerability/370010/what-is-spell-jacking), where security researchers have found some spell checking tools gathering personal identifiable information, even user’s passwords, from password input fields to send to third party services.

You can tell browsers not to autocapitalise values by setting the `autocapitalize` attribute to `off`.

Expand Down
2 changes: 1 addition & 1 deletion src/components/task-list/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The task list should not be used as a way of showing users their answers. For th

## How it works

There are 2 ways to use the task list component. You can use HTML or, if you’re using [Nunjucks](https://mozilla.github.io/nunjucks/) or the [GOV.UK Prototype Kit](https://govuk-prototype-kit.herokuapp.com), you can use the Nunjucks macro.
There are 2 ways to use the task list component. You can use HTML or, if you’re using [Nunjucks](https://mozilla.github.io/nunjucks/) or the [GOV.UK Prototype Kit](https://prototype-kit.service.gov.uk/docs/), you can use the Nunjucks macro.

{{ example({ group: "components", item: "task-list", example: "default", html: true, nunjucks: true, open: false, titleSuffix: "second" }) }}

Expand Down
4 changes: 2 additions & 2 deletions src/get-started/extending-and-modifying-components/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,9 @@ For example, to define a custom width for a specific reference number in your se

## Small modifications to components

The GOV.UK Design System uses a naming convention called [Block Element Modifier (BEM)](http://getbem.com/) which makes it easier to ensure styling is isolated to individual components. You can use this convention to make modifications to components.
The GOV.UK Design System uses a naming convention called [Block Element Modifier (BEM)](https://getbem.com/) which makes it easier to ensure styling is isolated to individual components. You can use this convention to make modifications to components.

When making small modifications to components you can make use of the [modifier convention from BEM](http://getbem.com/naming/), which uses a suffix of `--` plus a name, alongside your own [prefix].
When making small modifications to components you can make use of the [modifier convention from BEM](https://getbem.com/naming/), which uses a suffix of `--` plus a name, alongside your own [prefix].

For example, if you wanted to override the button component you could do the following.

Expand Down
4 changes: 2 additions & 2 deletions src/get-started/production/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ There are 2 ways to include GOV.UK Frontend in your project. You can either inst

### Option 1: install using npm

We recommend [installing GOV.UK Frontend using npm](https://frontend.design-system.service.gov.uk/installing-with-npm/#install-with-node-js-package-manager-npm).
We recommend [installing GOV.UK Frontend using npm](https://frontend.design-system.service.gov.uk/installing-with-npm/).

Using this option, you will be able to:

Expand All @@ -37,7 +37,7 @@ Using this option, you will be able to:

### Option 2: include compiled files

If your project does not use npm, or if you want to try out GOV.UK Frontend in your project without installing it through npm, you can [download and include compiled stylesheets, JavaScript and the asset files](https://frontend.design-system.service.gov.uk/installing-from-dist/#install-from-dist).
If your project does not use npm, or if you want to try out GOV.UK Frontend in your project without installing it through npm, you can [download and include compiled stylesheets, JavaScript and the asset files](https://frontend.design-system.service.gov.uk/install-using-precompiled-files/).

Using this option, you will be able to include all the CSS and JavaScript of GOV.UK Frontend in your project.

Expand Down
2 changes: 1 addition & 1 deletion src/patterns/confirm-a-phone-number/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Set up monitoring for potentially malicious behaviour, such as activity from une

## Research on this pattern

[Read the National Cyber Security Centre’s guidance on multi-factor authentication](https://www.ncsc.gov.uk/guidance/multi-factor-authentication-online-services).
[Read the National Cyber Security Centre’s guidance on multi-factor authentication](https://www.ncsc.gov.uk/collection/mfa-for-your-corporate-online-services).

### Services using this pattern

Expand Down
4 changes: 2 additions & 2 deletions src/patterns/contact-a-department-or-service-team/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ If you have social media channels:

### Write phone numbers in the GOV.UK style

See the [GOV.UK style for writing phone numbers](https://www.gov.uk/guidance/style-guide/a-to-z-of-gov-uk-style#phone-numbers).
See the [GOV.UK style for writing phone numbers](https://www.gov.uk/guidance/style-guide/a-to-z#telephone-numbers).

### Explain any charges

Expand All @@ -71,7 +71,7 @@ For phone call charges, link to the GOV.UK page on [call charges](https://www.go

### Give opening hours

Follow the GOV.UK style guide format for [time ranges](https://www.gov.uk/guidance/style-guide/a-to-z-of-gov-uk-style#times) and [date ranges](https://www.gov.uk/guidance/style-guide/a-to-z-of-gov-uk-style#dates).
Follow the GOV.UK style guide format for [time ranges](https://www.gov.uk/guidance/style-guide/a-to-z#times) and [date ranges](https://www.gov.uk/guidance/style-guide/a-to-z#dates).

Explain any exceptions, like bank holidays, or days of the week when your opening hours are different.

Expand Down
Loading
Loading