Test rendering all deleted and changed content files (#42420)
This commit is contained in:
55
.github/workflows/test-changed-content.yml
vendored
Normal file
55
.github/workflows/test-changed-content.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
name: Test changed content
|
||||
|
||||
# **What it does**: Runs the jest tests for changed and deleted content files.
|
||||
# **Why we have it**: Use GitHub Actions to run tests on changed content files.
|
||||
# **Who does it impact**: Docs engineering, open-source engineering contributors.
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
# This is important! If you make a PR against a megabranch, you
|
||||
# might actually want to delete a file without setting up a
|
||||
# redirect in its place. But if it's going into `main` we'll
|
||||
# want to make sure that doesn't happen.
|
||||
- main
|
||||
paths:
|
||||
- 'content/**'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
test-changed-content:
|
||||
runs-on: ${{ fromJSON('["ubuntu-latest", "ubuntu-20.04-xl"]')[github.repository == 'github/docs-internal'] }}
|
||||
steps:
|
||||
# Each of these ifs needs to be repeated at each step to make sure the required check still runs
|
||||
# Even if if doesn't do anything
|
||||
- name: Check out repo
|
||||
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
|
||||
with:
|
||||
# See https://github.com/tj-actions/changed-files#on-pull_request-
|
||||
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_READPUBLICKEY }}
|
||||
|
||||
- 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@246636f5fa148b5ad8e65ca4c57b18af3123e5f6 # v39.0.1
|
||||
with:
|
||||
files: 'content/**'
|
||||
|
||||
- name: Run tests
|
||||
env:
|
||||
CHANGED_FILES: ${{ steps.changed-files.outputs.modified_files }}
|
||||
DELETED_FILES: ${{ steps.changed-files.outputs.deleted_files }}
|
||||
run: npm test -- src/content-render/tests/render-changed-and-deleted-files.js
|
||||
Reference in New Issue
Block a user