question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error thrown running `storybook-to-ghpages` as a Github Action

See original GitHub issue

I’m running the following npm script from a Github Action: "deploy-storybook": "storybook-to-ghpages -p packages -o=storybook-static --ci"

When npm run deploy-storybook is executed locally, it runs successfully.

When run as part of my Github Action, it fails with a generic error message. Running build-storybook from CI has no issue.

Step:

      - name: Deploy to GH Pages
        env:
          GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
        run: npm run deploy-storybook

Error from Logs:

=> Deploying storybook
   executing: git push --force --quiet https://***@github.com/org/repo master:gh-pages
/home/runner/work/petra/petra/node_modules/@storybook/storybook-deployer/src/utils.js:14
  throw new Error(
  ^

Error: Exec code(128) on executing: git push --force --quiet https://***@github.com/org/repo master:gh-pages
undefined
    at Object.exec (/home/runner/work/petra/petra/node_modules/@storybook/storybook-deployer/src/utils.js:14:9)
    at Object.<anonymous> (/home/runner/work/petra/petra/node_modules/@storybook/storybook-deployer/bin/storybook_to_ghpages:69:14)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
    at internal/main/run_main_module.js:17:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:7
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

24reactions
Bjodolcommented, Jan 29, 2020

@tysonnero @speed-e Found a way to fix it! It seems the --ci option doesn’t include github actors in the git url. Simply replace your token line with the the following. GH_TOKEN: MyCompany:${{ secrets.GITHUB_TOKEN }}.

Step example:

            - name: Deploy storybook to Github Pages
              run: npm run deploy-storybook -- --ci
              env:
                  GH_TOKEN: MyCompany:${{ secrets.GITHUB_TOKEN }}
7reactions
woozykingcommented, May 8, 2020

nvm seems that you cannot directly reference another environment variable when you set env through env: in github actions

this can be further improved through the provided GITHUB_ACTOR env var

- name: Deploy storybook to Github Pages
  run: npm run deploy-storybook -- --ci
  env:
    GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}

updated working version based on comments below

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues · storybookjs/storybook-deployer - GitHub
Error thrown running storybook-to-ghpages as a Github Action. #77 opened on Jan 27, ... Error when run yarn deploy-storybook --ci in CircleCi.
Read more >
Setting exit codes for actions - GitHub Docs
You can use exit codes to set the status of an action. ... GitHub uses the exit code to set the action's check...
Read more >
Github Actions UI highlights errors where it finds "[error]" #12623
I would consider this a bug, because I would expect the source code section (dropdown run section) not to be highlighted.
Read more >
Workflow commands for GitHub Actions
Stops processing any workflow commands. This special command allows you to log anything without accidentally running a workflow command. For example, you could ......
Read more >
Workflow syntax for GitHub Actions
Example: Using PowerShell Desktop to run a script. Example: Running a python script. Custom shell. Exit codes and error action preference. jobs.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found