Running a bash script

Hi there,
What is the simplest way to create a workflow that runs a bash script?
I understand I can create a separate action which runs the script and use it in my workflow. I have done that for action shared among multiple repositories.

However, now I need to run a custom script in a single repo and, I feel a separate action is too much.

I’d like to be able to do run a bash script saved at ROOT/.github/ but I can’t figure out how to specify the path in the run step of the workflow below.

name: run-script
on: push

runs-on: ubuntu-latest
- uses: actions/checkout@v1
- name: script
run: PATH/
shell: bash
password: ${{ secrets.ACCESS_TOKEN }}


With that setup the path to the script is relative to the root of your repository, so if your script is .github/ that’s all that’s needed in the run step. Remember that the file must be marked as executable, or you need to explicitly call bash with the script as parameter.

To be more explicit, you can write ./.github/

If you want to know the full path where the working copy resides in the runner, then you can do run: pwd which will print the working directory.

The absolute path should be /home/runner/work/{repo-name}/{repo-name}/.github/, so this should also work:

- run: |
    # make file runnable, might not be necessary
    chmod +x "${GITHUB_WORKSPACE}/.github/"

    # run script
    # or
    "${{ format('{0}/.github/', github.workspace) }}"
1 Like

Thanks for the reply.

1 Like

Thanks for your help.