storyblok/storyblok-cli

Storyblok CLI in CI/CD Environment

Opened this issue · 0 comments

Hello, I want to generate types for my storyblok project using the storyblok cli. In order to have my types in sync I want to create a github action that generates types on every PR.

Current behavior:
Currently I am having issues using the storyblok cli in my github action.
When I run the action listed below, my workflow throws the following error:

 Hi, welcome to the Storyblok CLI

? Enter your email address: 
Error: Process completed with exit code 130.

When I run the same command from my local terminal everything seems to work.
Looks like in a CI/CD env the --token flag does not skip the prompt

Expected behavior:
Running the storyblok cli for generating types works in a CI/CD env the same way as it does in a local env.

Steps to reproduce:
https://github.com/christophsaile/next-storyblok

Related code:

name: Install Node.js and Storyblok CLI

on:
  pull_request:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-node@v3

      # Install Storyblok CLI
      - name: Install Storyblok CLI
        run: |
          npm install -g storyblok-cli

      # Storyblok login using the PAT from an environment variable (GitHub Secret)
      - name: Storyblok login
        run: storyblok login --token ${{ secrets.STORYBLOK_PAT }} --region eu

      # Pull Storyblok components
      - name: pull-sb-components
        run: storyblok pull-components --space 307181

      # Generate TypeScript types
      - name: generate-sb-type
        run: storyblok generate-typescript-typedefs --sourceFilePaths ./components.307181.json --destinationFilePath ./component-types-sb.d.ts

I was not able to find an example, guide or documentation how to use the cli in a CI/CD env, thats's why I opend this issue.
Thanks in advance for your support :)