-
Notifications
You must be signed in to change notification settings - Fork 56
56 lines (47 loc) · 1.45 KB
/
test-modulix-content.yaml
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
51
52
53
54
55
56
name: Test Modulix content
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
defaults:
run:
working-directory: api
jobs:
test-modulix-content:
if: contains(github.event.pull_request.labels.*.name, 'contribution-modulix')
runs-on: ubuntu-latest
continue-on-error: true
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: package.json
cache: npm
- name: Install dependencies
run: npm clean-install
- id: tests
name: Run Modulix Tests
run: |
set +e -o pipefail
npm run modulix:test 2>&1 | tee test_output.log
ERROR_CODE=$?
echo "TEST_ERRORS<<EOF" >> $GITHUB_ENV
cat test_output.log >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
exit $ERROR_CODE
- name: Comment PR with Test Modulix Error details
uses: actions/github-script@v6
if: ${{ failure() }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `Les tests Modulix ont échoué. Voici les détails :
\`\`\`
${process.env.TEST_ERRORS}
\`\`\``
})