Skip to content

Commit 71f6db5

Browse files
committed
feat: add PR updater with results
1 parent f87a248 commit 71f6db5

File tree

3 files changed

+67
-17
lines changed

3 files changed

+67
-17
lines changed

.github/workflows/build-and-test.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Generates an artifact containing the result of the `yarn compile` command.
2+
3+
name: Generate PR artifact
4+
5+
on:
6+
pull_request:
7+
types: [opened, synchronize]
8+
push:
9+
branches:
10+
- "!master"
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
test-personas-result: ${{ steps.test-personas.outputs.result }}
17+
steps:
18+
- uses: actions/checkout@v3
19+
with:
20+
ref: ${{ github.ref }}
21+
- uses: actions/setup-node@v3
22+
with:
23+
node-version: 18
24+
cache: "yarn"
25+
- run: yarn install --immutable
26+
- run: git log | head && git status
27+
- id: build
28+
name: Build
29+
run: yarn run build
30+
- id: test-personas
31+
name: Test the personas bilans against production
32+
run: |
33+
yarn test:personas --markdown > test-personas.res
34+
body="$(cat test-personas-latest.res | tail --lines=+3 | head --lines=-1)"
35+
body="${body//'%'/'%25'}"
36+
body="${body//$'\n'/'%0A'}"
37+
body="${body//$'\r'/'%0D'}"
38+
echo "::set-output name=result::${body}"
39+
40+
upload-artifact:
41+
runs-on: ubuntu-22.04
42+
needs: compile
43+
steps:
44+
- name: Create artifact
45+
run: |
46+
mkdir -p artifacts
47+
echo "
48+
<h1 align="center">Report for the pull request #${{ github.event.pull_request.number }}</h2>
49+
50+
## :couple: Personas changes
51+
52+
### Test personas bilans against latest published version
53+
54+
<details open=true>
55+
<summary>In details</summary>
56+
57+
${{ needs.compile.outputs.test-personas-result }}
58+
59+
</details>
60+
61+
" > artifacts/result.md
62+
- name: Upload artifact
63+
uses: actions/upload-artifact@v1
64+
with:
65+
name: pr_message
66+
path: artifacts

.github/workflows/build.yaml

Lines changed: 0 additions & 17 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"scripts": {
3737
"clean": "rm -r publicodes-evenements.model.json index.d.ts index.js",
3838
"build": "node build.js",
39+
"test:personas": "node tests/testPersonas.js",
3940
"build:watch": "nodemon -e \"publicodes\" --watch rules/ build.js & nodemon --watch publicodes-evenements.model.json copy.js",
4041
"doc:start": "node build && cp publicodes-evenements.model.json doc/src && cd doc && yarn run start",
4142
"doc:build": "node build && cp publicodes-evenements.model.json doc/src && cd doc && yarn run build"

0 commit comments

Comments
 (0)