-
Notifications
You must be signed in to change notification settings - Fork 68.9k
56 lines (46 loc) · 2.06 KB
/
Copy pathtest-changed-content.yml
File metadata and controls
56 lines (46 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Test changed content
# Renders changed pages and checks that deleted or renamed URLs still resolve before main-bound PRs merge.
on:
pull_request:
branches:
# Megabranch PRs may skip deleted-page checks, but main-bound PRs must keep old URLs resolving.
- main
paths:
- 'content/**'
- .github/workflows/test-changed-content.yml
permissions:
contents: read
jobs:
test-changed-content:
runs-on: ubuntu-latest
if: ${{ github.repository == 'github/docs-internal' || github.repository == 'github/docs' }}
steps:
# Repeat each if on its step so skipped work still leaves the required check present.
- name: Check out repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
# Fetch 2 commits so tj-actions/changed-files can diff without extra API calls
fetch-depth: 2
- uses: ./.github/actions/node-npm-setup
- uses: ./.github/actions/get-docs-early-access
if: ${{ github.repository == 'github/docs-internal' }}
with:
token: ${{ secrets.DOCS_BOT_PAT_BASE }}
- uses: ./.github/actions/cache-nextjs
- name: Run build script
run: npm run build
- name: Get changed files
id: changed_files
uses: tj-actions/changed-files@22103cc46bda19c2b464ffe86db46df6922fd323 # v47.0.5
with:
files: 'content/**'
# all_old_new_renamed_files exposes old,new pairs for renames.
# Without it, git status R files skip the deleted-file redirect check and old URLs 404.
include_all_old_new_renamed_files: true
- name: Run tests
env:
CHANGED_FILES: ${{ steps.changed_files.outputs.all_modified_files }}
DELETED_FILES: ${{ steps.changed_files.outputs.deleted_files }}
# Space-separated oldPath,newPath pairs; the test checks each old path like a deleted file.
RENAMED_FILES: ${{ steps.changed_files.outputs.all_old_new_renamed_files }}
run: npm test -- src/content-render/tests/render-changed-and-deleted-files.ts