ACT PR preview setup #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PR Preview | |
on: | |
pull_request: {} | |
jobs: | |
dispatch: | |
runs-on: ubuntu-latest | |
permissions: | |
pull-requests: write | |
env: | |
branch_name: ${{ github.event.pull_request.head.ref }} | |
GH_TOKEN: ${{ github.token }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '16' | |
cache: npm | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- run: git config --global url."https://github.com/".insteadOf ssh://git@github.com/ | |
- name: Install dependencies | |
run: npm ci | |
- name: Configure git | |
run: | | |
git config --global url."https://${{ secrets.WAI_GIT_NAME }}:${{ secrets.WAI_GIT_ACCESS_TOKEN }}@github.com".insteadOf "https://github.com" | |
git config --global user.name "${{ secrets.WAI_GIT_NAME }}" | |
git config --global user.email "${{ secrets.WAI_GIT_EMAIL }}" | |
- name: Build and deploy WAI update | |
run: npm run pr:preview | |
- name: Comment on PR with preview link | |
run: | | |
gh pr comment ${{ github.event.pull_request.number }} --body "Preview ready at https://deploy-preview-${branch_name}--wai-wcag-act-rules.netlify.app" |