fix(finefoods): prevent unnecessary API calls when search input is empty #457
Workflow file for this run
This file contains hidden or 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: Deploy Example Previews | |
| on: | |
| pull_request: | |
| paths: | |
| - "examples/finefoods-antd/**" | |
| - "examples/finefoods-client/**" | |
| - "examples/finefoods-material-ui/**" | |
| - "examples/pixels/**" | |
| - "examples/invoicer/**" | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - labeled | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: read | |
| outputs: | |
| examples: ${{ steps.filter.outputs.changes }} | |
| all_examples: ${{ steps.deploy-previews-label.outputs.all_examples }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Get PR labels | |
| id: pr-labels | |
| uses: joerick/[email protected] | |
| - name: "Check deploy previews label" | |
| if: ${{ contains(steps.pr-labels.outputs.labels, ' deploy-previews ') }} | |
| id: deploy-previews-label | |
| run: echo 'all_examples=["finefoods-antd", "finefoods-client", "finefoods-material-ui", "pixels", "invoicer"]' >> $GITHUB_OUTPUT | |
| - uses: dorny/paths-filter@v3 | |
| if: ${{ !contains(steps.pr-labels.outputs.labels, ' deploy-previews ') }} | |
| id: filter | |
| with: | |
| filters: | | |
| 'finefoods-antd': 'examples/finefoods-antd/**' | |
| 'finefoods-client': 'examples/finefoods-client/**' | |
| 'finefoods-material-ui': 'examples/finefoods-material-ui/**' | |
| 'pixels': 'examples/pixels/**' | |
| 'invoicer': 'examples/invoicer/**' | |
| deploy_previews: | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: ${{ needs.changes.outputs.examples }} | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 6 | |
| matrix: | |
| example: ${{ fromJSON(needs.changes.outputs.examples) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v3 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: "pnpm" | |
| - name: Install Dependencies | |
| run: pnpm install --ignore-scripts | |
| - name: Build example | |
| run: pnpm build --scope ${{ matrix.example }} | |
| - name: Deploy to Netlify | |
| uses: nwtgck/[email protected] | |
| with: | |
| publish-dir: ${{ format('./examples/{0}/{1}', matrix.example, contains(fromJson('["finefoods-client"]'), matrix.example) && '.next' || 'dist') }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| deploy-message: "[PR] Deploy from GitHub Actions" | |
| alias: deploy-preview-${{ matrix.example }}-${{ github.ref_name }} | |
| enable-pull-request-comment: true | |
| overwrites-pull-request-comment: true | |
| github-deployment-environment: "deploy-preview-${{ matrix.example }}-${{ github.ref_name }}" | |
| netlify-config-path: ./examples/${{ matrix.example }}/netlify.toml | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| timeout-minutes: 10 | |
| deploy_all_previews: | |
| runs-on: ubuntu-latest | |
| needs: changes | |
| if: ${{ needs.changes.outputs.all_examples }} | |
| strategy: | |
| fail-fast: false | |
| max-parallel: 6 | |
| matrix: | |
| example: ${{ fromJSON(needs.changes.outputs.all_examples) }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v3 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: "pnpm" | |
| - name: Install Dependencies | |
| run: pnpm install --ignore-scripts | |
| - name: Build example | |
| run: pnpm build --scope ${{ matrix.example }} | |
| - name: Deploy to Netlify | |
| uses: nwtgck/[email protected] | |
| with: | |
| publish-dir: ${{ format('./examples/{0}/{1}', matrix.example, contains(fromJson('["finefoods-client"]'), matrix.example) && '.next' || 'dist') }} | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| deploy-message: "[PR] Deploy from GitHub Actions" | |
| alias: deploy-preview-${{ matrix.example }}-${{ github.ref_name }} | |
| enable-pull-request-comment: true | |
| overwrites-pull-request-comment: true | |
| github-deployment-environment: "deploy-preview-${{ matrix.example }}-${{ github.ref_name }}" | |
| netlify-config-path: ./examples/${{ matrix.example }}/netlify.toml | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
| timeout-minutes: 10 |