結論
Cypress Screenshot & Video Upload to Slackをよくみてクレメンス
ハマりどころ
Inputs
token
Required Slack app token. See Internal app tokens
Create an app
Under Bot Token Scopes, add files:write and chat:write permissions
Install the app into your workspace
Invite the bot to whatever channels you want to send the videos and screenshots to /invite <botname>
Grab the Bot User OAuth Token from the OAuth & Permissions page
Add that token as a secret to your Github repo's Actions Secrets found under Settings -> Secrets (in the examples below we call it SLACK_TOKEN)
以下3点
- Under Bot Token Scopes, add files:write and chat:write permissions
- /invite botname
- Grab the Bot User OAuth Token from the OAuth & Permissions page
ここはGitHubの設定
- Add that token as a secret to your Github repo's Actions Secrets found under Settings -> Secrets (in the examples below we call it SLACK_TOKEN)
いざ実行
.github/workflows/e2e.yml
name: E2E Test
on:
pull_request:
branches: [ master ]
jobs:
e2e-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: 'Run tests'
uses: cypress-io/github-action@v2
- name: 'Upload screenshots and videos to Slack'
uses: trymbill/cypress-slack-video-upload-action@v1.3.0
with:
token: ${{ secrets.SLACK_TOKEN }}
channels: 'proj-...'
- name: 'Upload screenshots and videos to Slack'
uses: trymbill/cypress-slack-video-upload-action@v1.3.0
if: failure()
with:
token: ${{ secrets.SLACK_TOKEN }}
channels: 'proj-...'
message-text: 'Cypress tests failed! They have been placed in this thread, good luck.'