Skip to content
Draft
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
11 changes: 1 addition & 10 deletions .github/workflows/pr-check-lint_content.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
name: Lint content

on:
pull_request:
paths:
- .github/workflows/pr-check-lint_content.yml
- .nvmrc
- "*.md"
- "files/**/*.md"
workflow_call:

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
Expand Down
145 changes: 145 additions & 0 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
name: PR checks

on:
pull_request:

permissions:
contents: read

concurrency:
group: ci-${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
cspell: ${{ steps.filter.outputs.cspell }}
javascript: ${{ steps.filter.outputs.javascript }}
json: ${{ steps.filter.outputs.json }}
content: ${{ steps.filter.outputs.content }}
redirects: ${{ steps.filter.outputs.redirects }}
scripts: ${{ steps.filter.outputs.scripts }}
urls: ${{ steps.filter.outputs.urls }}
yaml: ${{ steps.filter.outputs.yaml }}
steps:
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
filters: |
shared: &shared
- .github/workflows/pr-check.yml
- .nvmrc
cspell:
- *shared
- .github/workflows/pr-check_cspell_lists.yml
- .vscode/dictionaries/*
- scripts/sort_and_unique_file_lines.js
javascript:
- *shared
- .github/workflows/pr-check_javascript.yml
- package.json
- package-lock.json
- "*.js"
- "*.mjs"
- "**/*.js"
- "**/*.mjs"
json:
- *shared
- .github/workflows/pr-check_json.yml
- "*.json"
- "*.jsonc"
- "**/*.json"
- "**/*.jsonc"
content:
- *shared
- .github/workflows/pr-check-lint_content.yml
- "*.md"
- files/**/*.md
redirects:
- *shared
- .github/workflows/pr-check_redirects.yml
- files/**
scripts:
- *shared
- .github/workflows/pr-check_scripts.yml
- package.json
- package-lock.json
urls:
- *shared
- .github/workflows/pr-check_url-issues.yml
- package.json
- package-lock.json
- files/**/*.md
- scripts/log-url-issues.js
yaml:
- *shared
- .github/workflows/pr-check_yml.yml
- package.json
- package-lock.json
- "*.yml"
- "*.yaml"
- "**/*.yml"
- "**/*.yaml"

cspell:
needs: changes
if: needs.changes.outputs.cspell == 'true'
uses: ./.github/workflows/pr-check_cspell_lists.yml

javascript:
needs: changes
if: needs.changes.outputs.javascript == 'true'
uses: ./.github/workflows/pr-check_javascript.yml

json:
needs: changes
if: needs.changes.outputs.json == 'true'
uses: ./.github/workflows/pr-check_json.yml

# `pr-reviewdog.yml` looks up this job by its name.
content:
needs: changes
if: needs.changes.outputs.content == 'true'
uses: ./.github/workflows/pr-check-lint_content.yml

redirects:
needs: changes
if: needs.changes.outputs.redirects == 'true'
uses: ./.github/workflows/pr-check_redirects.yml

scripts:
needs: changes
if: needs.changes.outputs.scripts == 'true'
uses: ./.github/workflows/pr-check_scripts.yml

urls:
needs: changes
if: needs.changes.outputs.urls == 'true'
uses: ./.github/workflows/pr-check_url-issues.yml

yaml:
needs: changes
if: needs.changes.outputs.yaml == 'true'
uses: ./.github/workflows/pr-check_yml.yml

# Required aggregate check: skipped checks pass, failures and cancellations do not.
all-checks-passed-or-skipped:
if: ${{ !cancelled() }}
needs:
- changes
- cspell
- javascript
- json
- content
- redirects
- scripts
- urls
- yaml
runs-on: ubuntu-latest
steps:
- name: Fail if any check did not pass
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
9 changes: 2 additions & 7 deletions .github/workflows/pr-check_cspell_lists.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,13 @@
name: Check cSpell lists

on:
pull_request:
paths:
- .github/workflows/pr-check_cspell_lists.yml
- .nvmrc
- .vscode/dictionaries/*
- scripts/sort_and_unique_file_lines.js
workflow_call:

# No GITHUB_TOKEN permissions, as we don't use it.
permissions: {}

jobs:
docs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/pr-check_javascript.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
name: JavaScript lint

on:
pull_request:
paths:
- .github/workflows/pr-check_javascript.yml
- .nvmrc
- package.json
- package-lock.json
- "*.js"
- "*.mjs"
- "**/*.js"
- "**/*.mjs"
workflow_call:

# No GITHUB_TOKEN permissions, as we only use it to increase API limit.
permissions: {}

jobs:
lint-js:
lint:
runs-on: ubuntu-latest

steps:
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/pr-check_json.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
name: JSON lint

on:
pull_request:
paths:
- .github/workflows/pr-check_json.yml
- .nvmrc
- "*.json"
- "*.jsonc"
- "**/*.json"
- "**/*.jsonc"
workflow_call:

# No GITHUB_TOKEN permissions, as we only use it to increase API limit.
permissions: {}

jobs:
lint-json:
lint:
runs-on: ubuntu-latest

steps:
Expand Down
19 changes: 2 additions & 17 deletions .github/workflows/pr-check_redirects.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Check Redirects

on:
pull_request:
workflow_call:

# No GITHUB_TOKEN permissions, as we only use it to increase API limit.
permissions: {}

jobs:
check-redirects:
check:
runs-on: ubuntu-latest

steps:
Expand All @@ -21,27 +21,12 @@ jobs:
node-version-file: ".nvmrc"
cache: npm

# This is a "required" workflow so path filtering can not be used:
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
# We have to rely on a custom filtering mechanism to run the checks only if required files are modified.
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
name: See if any file needs checking
id: filter
with:
filters: |
required_files:
- ".nvmrc"
- "files/**"
- ".github/workflows/pr-check_redirects.yml"

- name: Install
if: steps.filter.outputs.required_files == 'true'
run: npm ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check redirects file(s)
if: steps.filter.outputs.required_files == 'true'
run: npm run content validate-redirects en-US
env:
# Used by the `rari` cli to avoid rate limiting issues
Expand Down
11 changes: 3 additions & 8 deletions .github/workflows/pr-check_scripts.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
name: Check scripts

on:
pull_request:
paths:
- .github/workflows/pr-check_scripts.yml
- .nvmrc
- package.json
- package-lock.json
workflow_call:

# No GITHUB_TOKEN permissions, as we only use it to increase API limit.
permissions: {}
Expand Down Expand Up @@ -76,7 +71,7 @@ jobs:
echo "STDERR..................................................."
cat /tmp/stderr.log

filecheck:
filecheck-help:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -122,7 +117,7 @@ jobs:

- run: npm run content validate-redirects en-US

build:
build-help:
runs-on: ubuntu-latest

steps:
Expand Down
11 changes: 2 additions & 9 deletions .github/workflows/pr-check_url-issues.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
name: Check URL issues

on:
pull_request:
paths:
- .github/workflows/pr-check_url-issues.yml
- .nvmrc
- package.json
- package-lock.json
- "files/**/*.md"
- scripts/log-url-issues.js
workflow_call:

# No GITHUB_TOKEN permissions, as we don't use it.
permissions: {}

jobs:
check_url_issues:
check:
#if: github.repository == 'mdn/content'
runs-on: ubuntu-latest

Expand Down
13 changes: 2 additions & 11 deletions .github/workflows/pr-check_yml.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,13 @@
name: Lint YAML

on:
pull_request:
paths:
- .github/workflows/pr-check_yml.yml
- .nvmrc
- package.json
- package-lock.json
- "*.yml"
- "*.yaml"
- "**/*.yml"
- "**/*.yaml"
workflow_call:

# No GITHUB_TOKEN permissions, as we only use it to increase API limit.
permissions: {}

jobs:
lint-yml:
lint:
runs-on: ubuntu-latest

steps:
Expand Down
Loading
Loading