improve use-filter hook to run only on change (and not on first render anymore) #177
Workflow file for this run
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: Preview | |
on: | |
pull_request: | |
types: [opened, reopened, synchronize, closed] | |
env: | |
NODE_VERSION: 16 | |
VERCEL_SCOPE: aboutbits | |
VERCEL_ORGANIZATION_ID: team_e2WfHoRuw9BQVW7oYmMSKRJ6 | |
VERCEL_PROJECT_ID: prj_PBGTsidF0cEZ6uj5mN2Rev0pulxG | |
PREVIEW_DOMAIN: react-ui.aboutbits.dev | |
concurrency: | |
group: ${{ github.ref }}-preview | |
cancel-in-progress: true | |
jobs: | |
checks: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: aboutbits/github-actions-node/setup-and-install@v1 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Lint | |
run: npm run lint | |
shell: bash | |
- name: Typecheck | |
run: npm run typecheck | |
shell: bash | |
test: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: aboutbits/github-actions-node/setup-and-install@v1 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Test | |
run: npm run test | |
shell: bash | |
comment-link: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 5 | |
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' }} | |
steps: | |
- uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.createComment({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: 'Preview link: [https://${{ github.event.pull_request.number }}.${{ env.PREVIEW_DOMAIN }}](https://${{ github.event.pull_request.number }}.${{ env.PREVIEW_DOMAIN }})' | |
}) | |
deploy-preview: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 20 | |
if: ${{ github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize' }} | |
needs: | |
- checks | |
- test | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: aboutbits/github-actions-node/setup-and-install@v1 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- id: deploy | |
uses: aboutbits/github-actions-vercel/deploy@v1 | |
with: | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
vercel-organization-id: ${{ env.VERCEL_ORGANIZATION_ID }} | |
vercel-project-id: ${{ env.VERCEL_PROJECT_ID }} | |
- uses: aboutbits/github-actions-vercel/link-domain@v1 | |
with: | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
vercel-scope: ${{ env.VERCEL_SCOPE }} | |
deployment-domain: ${{ steps.deploy.outputs.url }} | |
preview-domain: ${{ github.event.pull_request.number }}.${{ env.PREVIEW_DOMAIN }} | |
unlink-domain: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
if: ${{ github.event.action == 'closed' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: aboutbits/github-actions-node/setup-and-install@v1 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- uses: aboutbits/github-actions-vercel/unlink-domain@v1 | |
with: | |
vercel-token: ${{ secrets.VERCEL_TOKEN }} | |
vercel-scope: ${{ env.VERCEL_SCOPE }} | |
preview-domain: ${{ github.event.pull_request.number }}.${{ env.PREVIEW_DOMAIN }} |