(iOS) Action failure due to location

Hello there! Apologies for the ambiguity of the topic title.

I’m having an issue that prevents me from running my workflow properly. Here’s a link to my repository to help.

All my previous attempts have failed so far, and I’m suspecting that the issue at hand is the location of the files. Referring to my repository, the structure of my repository is as such:

Upgrade
  Podfile
  Upgrade
  Upgrade.xcworkspace
  Upgrade.xcproj
  Pods
  Podfile.lock

In my action, I wanted to run Cocoapods to install all the dependencies for the project through pod install. However, when I did cd Upgrade/ the action fails and returns:

line 1: cd: Upgrade/: No such file or directory

What should I do to resolve this problem? All help is appreciated, thank you!

@arashnrim,

In a workflow, if some steps need to read or update the source files in the repository, the runner won’t automatically check out the source files or directly access the files from the remote GitHub repository.

Before the steps which need to access the source files, you should setup a step to check out the source files into the workspace (github.workspace) on the runner machine. You can use the Checkout action to do this.

- name: Checkout
  uses: actions/checkout@v2
  with:
    . . .

I checked the workflow file you used, but did not find any step was used to check out the source files (see here). No source files were checked out into the workspace, so the message “No such file or directory” was returned.
You can change your workflow like as below:


name: Build Xcode project

on: [push, pull_request]

jobs:
  build:
    runs-on: macos-latest
    steps:
      - name: Install Cocoapods
        run: |
          sudo gem install cocoapods

# checkout the source files from the remote GitHub repository
# so that the subsequent steps can access the source files
      - name: Checkout
        uses: actions/checkout@v2

      - name: Install dependencies
        run: |
          cd Upgrade/
          pod install

      - name: Build project
        run: |
          xcodebuild -workspace "Upgrade.xcworkspace" -scheme "Upgrade"
1 Like

Awesome, that did the trick! Thanks a lot!