mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-05-14 06:58:57 +00:00
52 lines
1.4 KiB
YAML
52 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=$(gh api --jq '[.labels[].name]' /repos/{owner}/{repo}/pulls/${{ github.event.number }})
|
|
echo "PR_LABELS=$LABELS" >> $GITHUB_ENV
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
- name: Get changed files
|
|
if: github.event_name == 'pull_request'
|
|
run: |
|
|
FILES=$(gh api --jq '[.files[].filename]' /repos/{owner}/{repo}/pulls/${{ github.event.number }}/files)
|
|
echo "CHANGED_FILES=$FILES" >> $GITHUB_ENV
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
- name: Run tests
|
|
run: npx ava tests/*.test.js --timeout=1m
|