Skip to content

chore(*): Update dependency supertest to v6.3.4 #4516

chore(*): Update dependency supertest to v6.3.4

chore(*): Update dependency supertest to v6.3.4 #4516

name: Update E2E Snapshot when comment on pr
on:
issue_comment:
types: [created]
jobs:
update-snapshot:
# The type of runner that the job will run on
runs-on: ubuntu-latest
if: contains(github.event.comment.html_url, '/pull/') && contains(github.event.comment.body, '/update-e2e-snapshot')
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: listen for PR Comments
uses: machine-learning-apps/actions-chatops@master
with:
TRIGGER_PHRASE: "/update-e2e-snapshot"
env: # you must supply GITHUB_TOKEN
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: prcomm
# This step clones the branch of the PR associated with the triggering phrase, but only if it is triggered.
- name: clone branch of PR
if: steps.prcomm.outputs.BOOL_TRIGGERED == 'true'
uses: actions/checkout@master
with:
ref: ${{ steps.prcomm.outputs.BRANCH_NAME }}
- name: Show current running workflows' id
if: steps.prcomm.outputs.BOOL_TRIGGERED == 'true'
uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
issue-number: ${{ github.event.issue.number }}
body: |
Update E2E Snapshot Triggered!
Address: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Try update snapshot
if: steps.prcomm.outputs.BOOL_TRIGGERED == 'true'
run: |
cd e2e
echo ::group::build
make server compose-args="--detach"
make wait-server
echo ::endgroup::build
make update-snapshot
make test # ensure test pass after update
- name: Commit result
if: steps.prcomm.outputs.BOOL_TRIGGERED == 'true'
run: |
git pull
git config --global user.name ${{ github.event.comment.user.login }}
git config --global user.email ${{ github.event.comment.user.login }}@github.fake
git add .
git commit -am 'test(e2e): update snapshot'
- name: Push changes
if: steps.prcomm.outputs.BOOL_TRIGGERED == 'true'
uses: ad-m/github-push-action@master
with:
# use my own token instead of GITHUB_TOKEN to trigger future workflows
github_token: ${{ secrets.WORKFLOW_TOKEN }}
branch: ${{ steps.prcomm.outputs.BRANCH_NAME }}
- name: Upload artifact if failed
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
if: failure() && steps.prcomm.outputs.BOOL_TRIGGERED == 'true'
with:
name: e2e-snapshots
path: e2e/cypress/snapshots
- name: Upload artifact if failed
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3
if: failure() && steps.prcomm.outputs.BOOL_TRIGGERED == 'true'
with:
name: e2e-videos
path: e2e/cypress/videos