-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (41 loc) · 1.28 KB
/
actions-scripts-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Test Action Scripts
on:
push:
paths:
- 'actions_scripts/**' # Trigger only when files in this folder are modified
pull_request:
paths:
- 'actions_scripts/**' # Run on PRs affecting the actions_scripts folder
jobs:
test-and-coverage-action-scripts:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout code
uses: actions/checkout@v4
# Set up Node.js environment
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '23'
# Install dependencies
- name: Install dependencies
run: npm ci
# Run tests and capture output
- name: Run tests
id: run_tests
run: |
{
echo 'tests_report<<EOF'
npm test 2>&1
echo EOF
} >> "$GITHUB_OUTPUT"
# Post comment on PR
- name: Add JEST results as a PR comment
uses: actions/github-script@v7
with:
script: |
const steps = ${{ toJSON(steps) }};
const { default: testReportOnPrComment } =
await import('${{ github.workspace }}/actions_scripts/tests_report_on_pr_comment.js');
await testReportOnPrComment({github, context, steps});