简体   繁体   中英

How to use working-directory in GitHub actions?

I'm trying to set-up and run a GitHub action in a nested folder of the repo.

I thought I could use working-directory , but if I write this:

jobs:
  test-working-directory:
    runs-on: ubuntu-latest
    name: Test
    defaults:
      run:
        working-directory: my_folder
    steps:
      - run: echo test

I get an error:

Run echo test
echo test
shell: /usr/bin/bash -e {0}
Error: An error occurred trying to start process '/usr/bin/bash' with working directory '/home/runner/work/my_repo/my_repo/my_folder'. No such file or directory

I notice my_repo appears twice in the path of the error.

Here is the run on my repo , where:

  • my_repo = novade_flutter_packages
  • my_folder = packages

What am I missing?

You didn't check out the repository on the second job.

Each job runs on a different instance, so you have to checkout it separately for each one of them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM