|  | 
| 7 | 7 |   e2e-smoketest: | 
| 8 | 8 |     name: E2E Smoketest | 
| 9 | 9 |     runs-on: ubuntu-latest | 
| 10 |  | -    if: ${{ github.event.workflow_run.conclusion == 'success' }} | 
|  | 10 | +    if: > | 
|  | 11 | +      ${{ github.event.workflow_run.event == 'pull_request' && | 
|  | 12 | +      github.event.workflow_run.conclusion == 'success' }} | 
| 11 | 13 |     steps: | 
| 12 |  | -    - name: checkout | 
| 13 |  | -      uses: actions/checkout@v2.3.4 | 
| 14 |  | -    - uses: actions/setup-go@v2 | 
|  | 14 | +    - name: 'Download artifact' | 
|  | 15 | +      uses: actions/github-script@v4.0.2 | 
| 15 | 16 |       with: | 
| 16 |  | -        go-version: '1.16' # The Go version to download (if necessary) and use. | 
| 17 |  | -    - name: download e2e artifacts | 
| 18 |  | -      uses: actions/download-artifact@v2 | 
| 19 |  | -      with: | 
| 20 |  | -        name: e2e-artifacts | 
| 21 |  | -        path: /tmp/e2e-artifacts | 
|  | 17 | +        script: | | 
|  | 18 | +          var artifacts = await github.actions.listWorkflowRunArtifacts({ | 
|  | 19 | +              owner: context.repo.owner, | 
|  | 20 | +              repo: context.repo.repo, | 
|  | 21 | +              run_id: ${{github.event.workflow_run.id }}, | 
|  | 22 | +          }); | 
|  | 23 | +          var matchArtifact = artifacts.data.artifacts.filter((artifact) => { | 
|  | 24 | +            return artifact.name == "e2e-artifacts" | 
|  | 25 | +          })[0]; | 
|  | 26 | +          var download = await github.actions.downloadArtifact({ | 
|  | 27 | +              owner: context.repo.owner, | 
|  | 28 | +              repo: context.repo.repo, | 
|  | 29 | +              artifact_id: matchArtifact.id, | 
|  | 30 | +              archive_format: 'zip', | 
|  | 31 | +          }); | 
|  | 32 | +          var fs = require('fs'); | 
|  | 33 | +          fs.writeFileSync('${{github.workspace}}/e2e-artifacts.zip', Buffer.from(download.data)); | 
|  | 34 | +    - run: unzip e2e-artifacts.zip | 
| 22 | 35 |     - name: Display structure of downloaded files | 
| 23 | 36 |       run: ls -R | 
| 24 | 37 |       working-directory: /tmp/e2e-artifacts | 
0 commit comments