Skip to content

Integrate Documentation from docs.rs.school into rs.school #110

Integrate Documentation from docs.rs.school into rs.school

Integrate Documentation from docs.rs.school into rs.school #110

name: Run Visual Testing on PR comment
on:
issue_comment:
types:
- created
env:
NODE_VERSION: 20.x
jobs:
run-visial-testing:
if: ${{ github.event.issue.pull_request && github.event.comment.body == 'run visual now' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout Pull Request
run: gh pr checkout ${{ github.event.issue.number }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Get the pull request information
id: get_pr
uses: actions/github-script@v7
with:
script: |
const issueNumber = context.issue.number;
const { data: pullRequest } = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: issueNumber,
});
core.setOutput('branch_name', pullRequest.head.ref);
core.setOutput('commit_sha', pullRequest.head.sha);
- uses: bahmutov/npm-install@v1
- name: Install Playwright browsers and dependencies
run: npx playwright install --with-deps
- run: npm run test:visual
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_PULL_REQUEST: ${{ github.event.issue.number }}
PERCY_COMMIT: ${{ steps.get_pr.outputs.commit_sha }}
PERCY_BRANCH: ${{ steps.get_pr.outputs.branch_name }}
API_URL: ${{ secrets.API_URL }}