Skip to content

Post PR comment

Post PR comment #394

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)