Files
is-a-dev/.github/workflows/ci.yml
T
William Harrison dfe7a94acd Update ci.yml
2025-03-06 20:01:20 +08:00

50 lines
1.4 KiB
YAML

name: CI
on:
pull_request:
push:
branches: [main]
paths:
- "domains/*"
- "tests/*"
- "util/*"
- ".github/workflows/ci.yml"
- "dnsconfig.js"
workflow_dispatch:
concurrency:
group: ${{ github.ref }}-ci
cancel-in-progress: true
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm install
- name: Get PR author
if: github.event_name == 'pull_request'
run: echo "PR_AUTHOR=${{ github.event.pull_request.user.login }}" >> $GITHUB_ENV
- name: Get PR labels
if: github.event_name == 'pull_request'
run: |
LABELS=$(jq -c '[.pull_request.labels[].name]' <<< '${{ toJson(github.event) }}')
echo "PR_LABELS=$LABELS" >> $GITHUB_ENV
- name: Get changed files
if: github.event_name == 'pull_request'
run: |
CHANGED_FILES=$(gh pr view ${{ github.event.pull_request.number }} --json files -q '.files[].path' | jq -c .)
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run tests
run: npx ava tests/*.test.js