Home > database >  How to print output of 'ls' command to github actions console?
How to print output of 'ls' command to github actions console?

Time:07-07

I'm having a problem where surprisingly I am unable to run scripts from my repo in a Github action. I have added an ls statement to see if I need to change into some other directory. However, the output from ls is not printed in the Github actions console.

name: Continuous integration pipeline

on: push

jobs:
  setup:
    name: Run Tests
    runs-on: ubuntu-20.04

    steps:
      - name: Checkout Repository
        uses: actions/checkout@v3
      - name: Use Node.js 14
        uses: actions/setup-node@v1
        with:
          node-version: "14.x"
      - name: Main
        run: |
          - ls
          - node scripts/setup-npm-version.js

How can I modify the ls statement so that the output will be printed in the console?

CodePudding user response:

Remove the dashes:

      - name: Main
        run: |
          ls
          node scripts/setup-npm-version.js

I would actually recommend splitting the two commands into two run steps:

      - run: ls
      - name: Main
        run: node scripts/setup-npm-version.js
  • Related