Post comment with workflow_run
diff --git a/.github/workflows/post_snapshot_comment.yml b/.github/workflows/post_snapshot_comment.yml
index b0b9bcc..da71ddf 100644
--- a/.github/workflows/post_snapshot_comment.yml
+++ b/.github/workflows/post_snapshot_comment.yml
@@ -4,19 +4,48 @@
workflow_run:
workflows: [Validate]
types:
- - completed
+ # TODO: change this back to completed
+ - in_progress
jobs:
- post-snapshot-comment:
+ download:
runs-on: ubuntu-latest
steps:
- uses: haya14busa/action-workflow_run-status@v1
if: github.event.workflow_run.event == 'pull_request'
+ - 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:
- message-id: ${{ github.sha }}
+ number: ${{ env.PR_NUMBER }}
+ message-id: ${{ env.GITHUB_SHA }}
message: |
**Snapshot Tests**
**API 23**: [Report](https://happo.io/a/27/report/${{ github.sha }}-android23) [Diff](https://happo.io/a/27/p/27/compare/master-android23/${{ github.sha }}-android23)
diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml
index b0a83dc..5ea7ee2 100644
--- a/.github/workflows/validate.yml
+++ b/.github/workflows/validate.yml
@@ -86,6 +86,18 @@
model=Pixel2,version=23
model=Pixel2,version=31
outputs-dir: build/test-results
+ - name: Save PR number
+ if: github.event_name == 'pull_request'
+ env:
+ PR_NUMBER: ${{ github.event.number }}
+ run: |
+ mkdir -p ./pr
+ echo PR_NUMBER=$PR_NUMBER > ./env/env
+ echo GITHUB_SHA=${{ github.sha }}
+ - uses: actions/upload-artifact@v3
+ with:
+ name: env
+ path: env/
deploy:
if: github.event_name == 'push' && github.repository == 'airbnb/lottie-android' && github.ref == 'refs/heads/master'
runs-on: ubuntu-latest