-
Notifications
You must be signed in to change notification settings - Fork 41
68 lines (59 loc) · 2.55 KB
/
statoscope_tests_report.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
name: Statoscope report publish
on:
workflow_run:
workflows: ['Statoscope diff analyze']
types:
- completed
jobs:
statoscope_publish_report:
name: Publish Statoscope Report
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
(github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure')
permissions:
pull-requests: write
steps:
- name: Download Artifacts
uses: dawidd6/action-download-artifact@v3
with:
workflow: ${{ github.event.workflow_run.workflow_id }}
run_id: ${{ github.event.workflow_run.id }}
- name: Extract data
id: extract-data
run: |
echo "REPORT_PR_NUMBER=$(cat statoscope-report/report-pr)" >> "$GITHUB_OUTPUT"
cp statoscope-report/result.json ./result.json
- name: Upload UI report to S3
id: upload-to-s3
run: |
aws --endpoint-url=${AWS_ENDPOINT} \
s3 cp statoscope-report/index.html s3://${AWS_BUCKET}/${{ github.ref }}/; \
echo "DOWNLOAD_LINK=$(aws --endpoint-url=${AWS_ENDPOINT} s3 presign s3://${AWS_BUCKET}/${{ github.ref }}/index.html)" >> $GITHUB_OUTPUT
env:
AWS_BUCKET: datalens-public-actions-reports
AWS_ENDPOINT: https://storage.yandexcloud.net
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: ru-central1
- name: Create comment text
uses: actions/github-script@v7
id: create-comment-text
with:
script: |
const fs = require('fs');
const downloadLink = "${{ steps.upload-to-s3.outputs.DOWNLOAD_LINK }}";
const data = JSON.parse(fs.readFileSync('result.json', 'utf8'));
data.downloadLink = downloadLink;
return `**📦 Statoscope quick diff with main-branch:**
**⏱ Build time:** ${data.buildTime.diff.formatted}
**⚖️ Initial size:** ${data.initialSize.diff.formatted}
**🕵️ Validation errors:** ${data.validation.total}
Full Statoscope report could be found [here ↗️](${data.downloadLink})`;
result-encoding: string
- name: Create Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
header: statoscope-report
number: ${{ steps.extract-data.outputs.REPORT_PR_NUMBER }}
message: "${{steps.create-comment-text.outputs.result}}"