Skip to content

Attempt to solve write access as a PR workflow from forks - part 2 #18

Attempt to solve write access as a PR workflow from forks - part 2

Attempt to solve write access as a PR workflow from forks - part 2 #18

Workflow file for this run

name: unit test
on:
push:
branches: [master, ci/**]
pull_request:
branches: [master, ci/**]
workflow_dispatch:
# Keep this to allow for triggering manually
jobs:
unit-test:
strategy:
matrix:
node-version:
# currently devDependencies require node>=16
# - 16 # skip
- 18
os:
- ubuntu-22.04
- windows-2022
- macos-12
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm install
- name: Lint
run: npm run lint
- name: Test
run: npm run test:cov
- name: Update Coverage Badge
# Is there a way to tell if a PR is from a forked repository? #26829
# https://github.com/orgs/community/discussions/26829#discussioncomment-3253580
if: >-
${{ matrix.os == 'ubuntu-22.04' && matrix.node-version == 18 && ((
github.event_name != 'pull_request'
) || (
github.event.pull_request.head.repo.full_name == github.repository
)) }}
uses: we-cli/coverage-badge-action@main