This repository was archived by the owner on Jan 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
61 lines (59 loc) · 2.24 KB
/
action.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
51
52
53
54
55
56
57
58
59
60
61
name: 'Keploy TestRun Report'
description: "A action to run e2e test run"
author: Alphasians
branding:
icon: 'activity'
color: 'orange'
inputs:
working-directory:
description: Relative path under $GITHUB_WORKSPACE where the repository was checked out
required: true
command:
description: Command to run the application
required: true
keploy-path:
description: Path to keploy
required: true
default: ./
runs:
using: "composite"
steps:
- name: Setup GITHUB_PATH for script
run: |
echo "${{ github.action_path }}" >> $GITHUB_PATH
echo "${{ inputs.working-directory }}"
shell: bash
- name: Grant permissions
run: chmod +x ${GITHUB_ACTION_PATH}/install.sh
shell: sh
- id: keploytestreport
name: Run Script
run: |
${GITHUB_ACTION_PATH}/install.sh > ${GITHUB_WORKSPACE}/${WORKDIR}/report.txt
grep "TESTRUN SUMMARY. For testrun with id: " ${GITHUB_WORKSPACE}/${WORKDIR}/report.txt | sed -r "s/\x1B\[[0-9;]*[mGK]//g" > ${GITHUB_WORKSPACE}/${WORKDIR}/final.out
grep "Total tests: " ${GITHUB_WORKSPACE}/${WORKDIR}/report.txt | sed -r "s/\x1B\[[0-9;]*[mGK]//g" >> ${GITHUB_WORKSPACE}/${WORKDIR}/final.out
grep "Total test passed: " ${GITHUB_WORKSPACE}/${WORKDIR}/report.txt | sed -r "s/\x1B\[[0-9;]*[mGK]//g" >> ${GITHUB_WORKSPACE}/${WORKDIR}/final.out
grep "Total test failed: " ${GITHUB_WORKSPACE}/${WORKDIR}/report.txt | sed -r "s/\x1B\[[0-9;]*[mGK]//g" >> ${GITHUB_WORKSPACE}/${WORKDIR}/final.out
echo 'KEPLOY_REPORT<<EOF' > $GITHUB_OUTPUT
cat ${GITHUB_WORKSPACE}/${WORKDIR}/final.out >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
shell: bash
env:
WORKDIR: ${{ inputs.working-directory }}
DELAY: ${{ inputs.delay }}
COMMAND : ${{ inputs.command }}
KEPLOY_PATH: ${{inputs.keploy-path}}
- name: Comment on PR
uses: actions/github-script@v6
env:
KEPLOY_REPORT: ${{ steps.keploytestreport.outputs.KEPLOY_REPORT }}
with:
github-token: ${{ github.token }}
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: process.env.KEPLOY_REPORT
})