|
| 1 | +name: PR Visual Tests Report |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_run: |
| 5 | + workflows: ['PR Visual Tests'] |
| 6 | + types: |
| 7 | + - completed |
| 8 | + |
| 9 | +jobs: |
| 10 | + comment: |
| 11 | + name: Create GitHub Comment |
| 12 | + if: github.event.workflow_run.event == 'pull_request' |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Generate token |
| 16 | + id: generate-token |
| 17 | + uses: actions/create-github-app-token@v2 |
| 18 | + with: |
| 19 | + app-id: ${{ secrets.GRAVITY_UI_APP_ID }} |
| 20 | + private-key: ${{ secrets.GRAVITY_UI_APP_PRIVATE_KEY }} |
| 21 | + - name: Download Artifacts |
| 22 | + uses: actions/download-artifact@v4 |
| 23 | + with: |
| 24 | + github-token: ${{ steps.generate-token.outputs.token }} |
| 25 | + run-id: ${{ github.event.workflow_run.id }} |
| 26 | + - name: Extract PR Number |
| 27 | + id: pr |
| 28 | + run: echo "::set-output name=id::$(<pr/pr-id.txt)" |
| 29 | + shell: bash |
| 30 | + - name: Install AWS CLI |
| 31 | + uses: unfor19/install-aws-cli-action@v1 |
| 32 | + with: |
| 33 | + version: 2.22.35 |
| 34 | + arch: amd64 |
| 35 | + - name: Upload to S3 |
| 36 | + env: |
| 37 | + AWS_ACCESS_KEY_ID: ${{ secrets.STORYBOOK_S3_KEY_ID }} |
| 38 | + AWS_SECRET_ACCESS_KEY: ${{ secrets.STORYBOOK_S3_SECRET_KEY }} |
| 39 | + AWS_DEFAULT_REGION: ru-central1 |
| 40 | + AWS_EC2_METADATA_DISABLED: true |
| 41 | + run: aws s3 cp playwright-report s3://playwright-reports/date-components/pulls/${{ steps.pr.outputs.id}}/ --endpoint-url=https://storage.yandexcloud.net --recursive |
| 42 | + shell: bash |
| 43 | + - name: Create Comment |
| 44 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 45 | + with: |
| 46 | + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} |
| 47 | + number: ${{ steps.pr.outputs.id }} |
| 48 | + header: visual tests report |
| 49 | + message: '[Visual Tests Report](https://storage.yandexcloud.net/playwright-reports/date-components/pulls/${{ steps.pr.outputs.id }}/index.html) is ready.' |
0 commit comments