Switch to base folder param #11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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' | ||
| - 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 }} | ||