-
Notifications
You must be signed in to change notification settings - Fork 8
80 lines (72 loc) · 2.82 KB
/
e2e-test-post-results.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Post E2E results in pull request
on:
workflow_dispatch:
inputs:
pr-number:
type: string
description: The PR number in which to post the results
required: true
e2e-status:
type: string
description: The status of the E2E tests (failure or success)
required: true
e2e-run-url:
type: string
description: The URL of the E2E tests run
required: true
check-id:
type: string
description: Github check ID of the E2E tests in the pull request
required: true
jobs:
e2e-post-results:
runs-on: ubuntu-24.04
steps:
- name: Add a comment with E2E tests results in the Pull Request
uses: actions/github-script@v7
with:
script: |
let commentBody = '❌ E2E tests have failed. \n';
if ('${{ github.event.inputs.e2e-status }}' === 'success') {
commentBody = '✅ E2E tests have been successfully completed. \n';
}
commentBody += '➡️ You can find the results [here](${{ github.event.inputs.e2e-run-url }}).';
commentBody += '\n\n<!-- id:e2e-test-run-info -->';
github.rest.issues.createComment({
issue_number: ${{ github.event.inputs.pr-number }},
owner: context.repo.owner,
repo: context.repo.repo,
body: commentBody
})
- name: Generate Github token for PR checks
id: github-token-checks
uses: actions/create-github-app-token@v1
continue-on-error: true
with:
app-id: ${{ secrets.ALMA_UPDATE_CHECKS_APP_ID }}
private-key: ${{ secrets.ALMA_UPDATE_CHECKS_APP_PEM }}
repositories: alma-installments-prestashop
- name: Update check in PR with E2E tests results
uses: actions/github-script@v7
with:
github-token: ${{ steps.github-token-checks.outputs.token }}
script: |
let checkStatus = 'completed';
let checkConclusion = 'success';
let checkOutput = {
title: 'E2E tests',
summary: '✅ E2E tests have been successfully completed',
text: `➡️ You can find the results [here](${{ github.event.inputs.e2e-run-url }}).`
};
if ('${{ github.event.inputs.e2e-status }}' === 'failure') {
checkConclusion = 'failure';
checkOutput.summary = '❌ E2E tests have failed.';
}
github.rest.checks.update({
owner: context.repo.owner,
repo: context.repo.repo,
check_run_id: '${{ github.event.inputs.check-id }}',
status: checkStatus,
conclusion: checkConclusion,
output: checkOutput
})