Fix link text #8
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: Node.js CI Validate | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, closed] | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| jobs: | |
| ci-validate: | |
| # run on any change whatsoever, but don't run on a cancel PR | |
| if: github.event_name != 'pull_request' || ( | |
| github.event.action == 'opened' || | |
| github.event.action == 'synchronize' || | |
| github.event.action == 'reopened' && github.event.before != github.event.after || | |
| github.event.action == 'closed' && github.event.pull_request.merged == true | |
| ) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check if default branch configured in the runner (yet), and suppress warning | |
| run: | | |
| # Capture system-level default branch config | |
| SYS_INIT_KEY=$(git config --system init.defaultBranch 2>/dev/null || echo '<none>') | |
| echo 'Temporary: System-level Git init.defaultBranch? ...'"$SYS_INIT_KEY" | |
| # Inject our own branch config until the runner is improved | |
| if [ "$SYS_INIT_KEY" = "<none>" ]; then | |
| git config --global init.defaultBranch main | |
| echo 'Temporary: Git init.defaultBranch set to "main" to suppress `git init` warning' | |
| fi | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 'latest' | |
| cache: 'npm' | |
| - name: Install system dependencies | |
| run: sudo apt-get update && sudo apt-get install -y iverilog | |
| - name: Install npm dependencies | |
| working-directory: ./scripts | |
| run: npm ci | |
| - name: Run tests | |
| working-directory: ./scripts | |
| run: npm test | |
| ci-close-pr: | |
| # run on a cancel PR | |
| if: github.event_name == 'pull_request' && github.event.pull_request.merged == false | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Just report closed PR with no merge | |
| run: | | |
| echo PR #${{ github.event.number }} has been closed, not merged |