GH Action fails when installing internal dependencies in monorepo

Mikael Pettersson 1 Reputation point
2022-10-26T14:06:34.873+00:00

I have a project that is managed in a Turborepo.

repo structure:

  • apps
    • storefront (next.js app)
  • libs
    • ui (@ms/ui lib)
    • services (other @ms/ lib)

When the Azure/static-web-apps-deploy@v1 GH action tries to install the dependencies in a next.js app in the monorepo, and encounters a package that is an internal package (eg@ms/ui), it fails.
Our other GH pipes that run linting, tests and builds can install the dependencies just fine, it's only the SWA deployment action that fails.

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
964 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 26,626 Reputation points Microsoft Employee
    2022-10-27T18:56:34.61+00:00

    MikaelPettersson-2350,

    To target a workflow file to a single app, you specify paths in the push and pull_request sections.

    Just to highlight, when you set up a monorepo, each static app configuration is scoped to only files for a single app. The different workflow files live side by side in the repository's .github/workflows folder.
    Please take a look at the sample (below).

    Also, use skip_api_build in GitHub Actions. In order to use it, set skip_api_build: true in the GitHub workflow yaml and specify the ApiRuntime version in the staticwebapp.config.json file in source repository.

    Sample:

        on:  
          push:  
            branches:  
              - main  
            paths:  
              - app1/**  
              - api1/**  
              - .github/workflows/azure-static-web-apps-purple-pond.yml  
          pull_request:  
            types: [opened, synchronize, reopened, closed]  
            branches:  
              - main  
            paths:  
              - app1/**  
              - api1/**  
              - .github/workflows/azure-static-web-apps-purple-pond.yml  
    

    See:
    Build configuration for Azure Static Web Apps | Monorepo support
    Discussion thread

    Kindly let us know how it goes, I'll follow-up with you further.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.