-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
51 lines (49 loc) · 1.94 KB
/
post_snapshot_comment.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
name: Post PR comment
on:
workflow_run:
workflows: [Validate]
types:
- completed
jobs:
post-comment:
runs-on: ubuntu-latest
if: github.event.workflow_run.event == 'pull_request'
steps:
- uses: haya14busa/action-workflow_run-status@v1
- name: 'Download artifact'
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "env"
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/env.zip`, Buffer.from(download.data));
- name: 'Unzip artifact'
run: |
unzip env.zip
ls -ltR
while read line; do
echo "$line" >> $GITHUB_ENV
done < env
- name: 'Post PR comment'
uses: mshick/add-pr-comment@v2
if: github.event.workflow_run.event == 'pull_request'
with:
issue: ${{ env.PR_NUMBER }}
message-id: ${{ env.GITHUB_SHA }}
message: |
**Snapshot Tests**
**API 23**: [Report](https://happo.io/a/27/report/${{ env.GITHUB_SHA }}-android23) [Diff](https://happo.io/a/27/p/27/compare/master-android23/${{ env.GITHUB_SHA }}-android23)
**API 31**: [Report](https://happo.io/a/27/report/${{ env.GITHUB_SHA }}-android31) [Diff](https://happo.io/a/27/p/27/compare/master-android31/${{ env.GITHUB_SHA }}-android31)