name: CI Validate on: pull_request: types: [opened, synchronize, reopened, closed] branches: [main] paths-ignore: - 'docs/**' - 'images/**' push: branches: [main] paths-ignore: - 'docs/**' - 'images/**' 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 '') echo 'Temporary: System-level Git init.defaultBranch? ...'"$SYS_INIT_KEY" # Inject our own branch config until the runner is improved if [ "$SYS_INIT_KEY" = "" ]; 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 cache-dependency-path: './scripts/package-lock.json' - 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: Test 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'