Skip to content

WIP workflow to run tests #13

WIP workflow to run tests

WIP workflow to run tests #13

Workflow file for this run

name: Automated test for PRs
# Run any time a PR is created or modified
on:
pull_request:
types: [opened, reopened, synchronize]
env:
# The folder that Docusaurus hosts static files (images) from
STATIC_FOLDER: 'static'
# Images to ignore for image use checks
IGNORE_IMAGES: 'img/site'
jobs:
# Get files that are added or changed in this PR
getChangedFiles:
runs-on: ubuntu-latest
outputs:
files: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
steps:
# https://github.com/marketplace/actions/changed-files
- name: Get all changed MD/MDX files
id: changed-markdown-files
uses: tj-actions/changed-files@24d32ffd492484c1d75e0c0b894501ddb9d30d62 # v47
with:
files: |
docs/**/*.md
docs/**/*.mdx
- name: List all changed files
env:
ALL_CHANGED_FILES: ${{ steps.changed-markdown-files.outputs.all_changed_files }}
run: |
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
done
# Test the changed files
test:
runs-on: ubuntu-latest
needs: getChangedFiles
if: ${{ needs.getChangedFiles.outputs.files != '' }}
env:
# Create a comma-separated list of changed MD and MDX files
ALL_CHANGED_FILES: ${{ join(needs.checkChangedFiles.outputs.files, ',') }}
steps:
# Clone the repo and install dependencies
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 20
# - run: npm ci
# Clone tests from https://gitlab.com/nomadic-labs/doclib
# Uses https://github.com/marketplace/actions/any-clone-repo
- name: Clone test repo
uses: chihqiang/checkout-action@main
with:
repo: https://gitlab.com/nomadic-labs/doclib.git
branch: main
dest: doclib
- name: Install test repo dependencies
working-directory: doclib
run : npm ci
# Run tests
- name: Run used image check
working-directory: doclib
run: npm run usedImages -- --baseFolder=${{ github.workspace }} --docFiles=${{ env.ALL_CHANGED_FILES }} --imageFolder=${{ env.STATIC_FOLDER }}