hunk.code_window: const USER_MAIL_DOMAIN = 'mail.domain.com';
   const USER_PARSE_WEBHOOK = 'user-parse.com/webhook';
   describe('Should handler the new arrived mail', () => {
     let inboundEmailParseUsecase: InboundEmailParse;
  
hunk.labels: keep keep replace keep keep keep
hunk.after_edit: const USER_PARSE_WEBHOOK = 'user-parse.com/webhook/{{compiledVariable}}';
  
hunk.file_path: apps/api/src/app/inbound-parse/e2e/inbound-email-parse.e2e.ts
hunk.type: replace
file: name: Build Worker Docker Image
  
  description: 'Builds a docker image for the Worker'
  
  inputs:
    tag:
      description: 'The tag to use for the image'
      required: false
    push:
      description: 'Push the image to the registry'
      required: false
      default: 'false'
    github_token:
      description: 'The token to use for logging into ghcr.io'
      required: true
    fork:
      description: 'Whether this is being triggered from a forked repo'
      required: false
      default: 'false'
    docker_name:
      description: 'Name for docker image'
      required: true
  
    bullmq_secret:
      description: 'Bullmq secret api token'
      required: true
  
  outputs:
    image:
      description: 'The image that was built'
      value: ${{ steps.build-image.outputs.IMAGE }}
  
  runs:
    using: composite
    steps:
      - name: ⛏️ build worker
        shell: bash
        run: pnpm build:worker
  
      # - name: 🚢 Setup Depot
      #   uses: depot/setup-action@v1
      #   with:
      #     oidc: true
  
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
  
      - name: Login To Registry
        shell: bash
        env:
          GH_ACTOR: ${{ github.actor }}
          GH_PASSWORD: ${{ inputs.github_token }}
        run: |
          echo $GH_PASSWORD | docker login ghcr.io -u $GH_ACTOR --password-stdin
  
      - name: Set Bull MQ Env variable for EE
        shell: bash
        run: |
          echo "BULL_MQ_PRO_NPM_TOKEN=${{ inputs.bullmq_secret }}" >> $GITHUB_ENV
        if: contains( inputs.docker_name  , 'ee')
  
      # - name: Build with Depot, tag, and test - Regular
      #   if: ${{ inputs.fork == 'false' }} # Use buildx for forks as they can't access secrets
      #   shell: bash
      #   env:
      #     REGISTRY_OWNER: novuhq
      #     DOCKER_NAME: ${{ inputs.docker_name }}
      #     IMAGE_TAG: ${{ github.sha }}
      #     DEPOT_PROJECT_ID: 6sj0jfv0n7
      #     GH_ACTOR: ${{ github.actor }}
      #     GH_PASSWORD: ${{ inputs.github_token }}
      #   run: |
      #     set -x
      #     cd apps/worker && pnpm run docker:build:depot --build-arg BULL_MQ_PRO_TOKEN=${BULL_MQ_PRO_NPM_TOKEN}
  
      - name: Build with Buildx, tag, and test
        # if: ${{ inputs.fork == 'true' }} # Use buildx for forks as they can't access secrets
        shell: bash
        env:
          REGISTRY_OWNER: novuhq
          DOCKER_NAME: ${{ inputs.docker_name }}
          IMAGE_TAG: ${{ github.sha }}
          DEPOT_PROJECT_ID: 6sj0jfv0n7
          GH_ACTOR: ${{ github.actor }}
          GH_PASSWORD: ${{ inputs.github_token }}
        run: |
          set -x
          cd apps/worker && pnpm run docker:build --build-arg BULL_MQ_PRO_TOKEN=${BULL_MQ_PRO_NPM_TOKEN}
  
      - name: Tag and test
        id: build-image
        shell: bash
        env:
          REGISTRY_OWNER: novuhq
          DOCKER_NAME: ${{ inputs.docker_name }}
          IMAGE_TAG: ${{ github.sha }}
          DEPOT_PROJECT_ID: 6sj0jfv0n7
          GH_ACTOR: ${{ github.actor }}
          GH_PASSWORD: ${{ inputs.github_token }}
        run: |
          echo "Tag image"
          docker images --all
          docker tag novu-worker ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
  
          echo "Run image"
          docker run --network=host --name worker -dit --env NODE_ENV=test ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
          docker run --network=host appropriate/curl --retry 10 --retry-delay 5 --retry-connrefused http://localhost:1342/v1/health-check | grep 'ok'
  
          echo "::set-output name=IMAGE::ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG"
  
      - name: Optionally tag docker image
        if: ${{ inputs.tag }}
        shell: bash
        env:
          REGISTRY_OWNER: novuhq
          DOCKER_NAME: ${{ inputs.docker_name }}
          IMAGE_TAG: ${{ github.sha }}
        run: |
          docker tag ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:${{ inputs.tag }}
  
      - name: Push PR tag image
        if: ${{ inputs.push == 'true' }}
        shell: bash
        env:
          REGISTRY_OWNER: novuhq
          DOCKER_NAME: ${{ inputs.docker_name }}
          IMAGE_TAG: ${{ github.sha }}
        run: |
          docker push ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:$IMAGE_TAG
  
      - name: Push custom tag image
        if: ${{ inputs.push == 'true' && inputs.tag }}
        shell: bash
        env:
          REGISTRY_OWNER: novuhq
          DOCKER_NAME: ${{ inputs.docker_name }}
        run: |
          docker push ghcr.io/$REGISTRY_OWNER/$DOCKER_NAME:${{ inputs.tag }}
  