WIP workflow to run tests #2
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 | |
| on: | |
| pull_request: | |
| types: [opened, reopened, synchronize] | |
| jobs: | |
| getChangedFiles: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| files: ${{ steps.changed-markdown-files.outputs.all_changed_files }} | |
| steps: | |
| # Get files that are added or changed in this PR | |
| # 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,mdx}' | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: getChangedFiles | |
| if: ${{ needs.getChangedFiles.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' | |
| # Run tests | |
| - run: | | |
| for file in ${ALL_CHANGED_FILES}; do | |
| echo "$file was changed" | |
| done |