Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Copilot Lvl 3
Message 1 of 4

How to execute a script file using GitHub Action?

I am trying to run a bash script file inside GitHub Action, but it is return an error.

 

chrome_b37A8cjrrc.png

 

name: CI
on: push

jobs:
  linux:
    name: Linux build on node ${{ matrix.node_version }}
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node_version: [8.x, 10.x]

    steps:
    - name: Checkout
      uses: actions/checkout@v1

    - name: Set Node.js version ${{ matrix.node_version }}
      uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node_version }}

    - name: Install packages
      run: npm install

    - name: Run build
      run: npm run build:linux

    - name: Moving build to artifacts directory
      run: ./scripts/moveFiles.sh
3 Replies
Copilot Lvl 3
Message 2 of 4

Re: How to execute a script file using GitHub Action?

Does it require GitHub Token to access to repository files?

Copilot Lvl 3
Message 3 of 4

Re: How to execute a script file using GitHub Action?

Looks like lack of execution permission. Have you tried to

chmod +x ./scripts/moveFiles.sh

and commiting the file?

 

Highlighted
GitHub Partner
Message 4 of 4

Re: How to execute a script file using GitHub Action?

Hi mittalyashu,

 

The file should be lack of execution permission. You can add an extra step to check the detail permission of the bash file.

ls -l ./scripts/moveFiles.sh

Two methods:

1. Add prior step with command below:

 - name: Moving build to artifacts directory
run: |
chmod +x ./scripts/moveFiles.sh
./scripts/moveFile.sh

2. Or directly add 'sh' before the command:

 - name: Moving build to artifacts directory
run: |
sh ./scripts/moveFile.sh