Skip to content

Commit

Permalink
feat: add PR updater with results
Browse files Browse the repository at this point in the history
  • Loading branch information
Clemog committed Mar 9, 2024
1 parent f87a248 commit 71f6db5
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 17 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Generates an artifact containing the result of the `yarn compile` command.

name: Generate PR artifact

on:
pull_request:
types: [opened, synchronize]
push:
branches:
- "!master"

jobs:
build:
runs-on: ubuntu-latest
outputs:
test-personas-result: ${{ steps.test-personas.outputs.result }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.ref }}
- uses: actions/setup-node@v3
with:
node-version: 18
cache: "yarn"
- run: yarn install --immutable
- run: git log | head && git status
- id: build
name: Build
run: yarn run build
- id: test-personas
name: Test the personas bilans against production
run: |
yarn test:personas --markdown > test-personas.res
body="$(cat test-personas-latest.res | tail --lines=+3 | head --lines=-1)"
body="${body//'%'/'%25'}"
body="${body//$'\n'/'%0A'}"
body="${body//$'\r'/'%0D'}"
echo "::set-output name=result::${body}"
upload-artifact:
runs-on: ubuntu-22.04
needs: compile
steps:
- name: Create artifact
run: |
mkdir -p artifacts
echo "
<h1 align="center">Report for the pull request #${{ github.event.pull_request.number }}</h2>
## :couple: Personas changes
### Test personas bilans against latest published version
<details open=true>
<summary>In details</summary>
${{ needs.compile.outputs.test-personas-result }}
</details>
" > artifacts/result.md
- name: Upload artifact
uses: actions/upload-artifact@v1
with:
name: pr_message
path: artifacts
17 changes: 0 additions & 17 deletions .github/workflows/build.yaml

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"scripts": {
"clean": "rm -r publicodes-evenements.model.json index.d.ts index.js",
"build": "node build.js",
"test:personas": "node tests/testPersonas.js",
"build:watch": "nodemon -e \"publicodes\" --watch rules/ build.js & nodemon --watch publicodes-evenements.model.json copy.js",
"doc:start": "node build && cp publicodes-evenements.model.json doc/src && cd doc && yarn run start",
"doc:build": "node build && cp publicodes-evenements.model.json doc/src && cd doc && yarn run build"
Expand Down

0 comments on commit 71f6db5

Please sign in to comment.