I'm trying to install my dependencies on my workflow script. However, some are private pods, and it gives me this error when I try and do bundle exec pod install
:
Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs`
Cloning spec repo `keterauk` from `https://github.com/KeteraUK/Strive-Pod-Specs`
[!] Unable to add a source with url `https://github.com/KeteraUK/Strive-Pod-Specs` named `keterauk`.
You can try adding it manually in `/Users/runner/.cocoapods/repos` or via `pod repo add`.
##[error]Process completed with exit code 1.
pod repo add...
results in this error: fatal: could not read Username for 'https://github.com': Device not configured
even when i have my personal access token (secret) added.
Here's my full script:
name: Swift
on:
push:
branches:
- master
- enhancement/*
- develop
- develop/*
- release
- release/*
jobs:
test:
name: Test
runs-on: macOS-latest
strategy:
matrix:
destination: ['platform=iOS Simulator,OS=13.3,name=iPhone 11']
xcode: ['/Applications/Xcode_11.6.app/Contents/Developer']
steps:
- name: Checkout
uses: actions/checkout@v1
with:
token: ${{ secrets.STRIVE_ACTIONS_SECRET }} # PAT
- name: Bundle Update
run: gem install bundler:1.17.2
- name: Bundle Install
run: bundle install
# Currently fails here...
- name: Specs Repo
run: pod repo add Strive-Pod-Specs https://github.com/KeteraUK/Strive-Pod-Specs.git
- name: Dependencies
run: bundle exec pod install
env:
DEVELOPER_DIR: ${{ matrix.xcode }}
- name: Build and test
run: bundle exec fastlane scan --destination "${destination}" --scheme "CI"
env:
destination: ${{ matrix.destination }}
DEVELOPER_DIR: ${{ matrix.xcode }}
How can I install private pods with my workflow GitHub Actions script?
Note: I'm also trying to do this via an organisation.
You haven't provided the API token in the pod repo add https://github...
command and most likely it fails due to that. Please add your personal API token to the github url like <token>@github.com
. You can use secrets
and env
to do the same.
Most likely the following should help pass the error you are encountering:
name: Swift
on:
push:
branches:
- master
- enhancement/*
- develop
- develop/*
- release
- release/*
jobs:
test:
name: Test
runs-on: macOS-latest
strategy:
matrix:
destination: ['platform=iOS Simulator,OS=13.3,name=iPhone 11']
xcode: ['/Applications/Xcode_11.6.app/Contents/Developer']
steps:
- name: Checkout
uses: actions/checkout@v1
with:
token: ${{ secrets.STRIVE_ACTIONS_SECRET }} # PAT
- name: Bundle Update
run: gem install bundler:1.17.2
- name: Bundle Install
run: bundle install
- name: Specs Repo
run: pod repo add Strive-Pod-Specs https://${POD_GITHUB_API_TOKEN}@github.com/KeteraUK/Strive-Pod-Specs.git
env:
POD_GITHUB_API_TOKEN: ${{ secrets.POD_GITHUB_API_TOKEN }}
- name: Dependencies
run: bundle exec pod install
env:
DEVELOPER_DIR: ${{ matrix.xcode }}
- name: Build and test
run: bundle exec fastlane scan --destination "${destination}" --scheme "CI"
env:
destination: ${{ matrix.destination }}
DEVELOPER_DIR: ${{ matrix.xcode }}
The modified lines are:
run: pod repo add Strive-Pod-Specs https://${POD_GITHUB_API_TOKEN}@github.com/KeteraUK/Strive-Pod-Specs.git
env:
POD_GITHUB_API_TOKEN: ${{ secrets.POD_GITHUB_API_TOKEN }}
Make sure you define a secret POD_GITHUB_API_TOKEN with your personal access token.
The error is telling that git
needs you to authenticate or authorize. So there are multiple options for you to achieve that.
The first and the most recommended option is to use SSH
instead of HTTPS
. So the machine will use the key automatically and will not ask you for the username. and password every time. So the URL would be like: ssh://<user>@github.com/KeteraUK/Strive-Pod-Specs.git
The second option is to hard code the username and password of the git. This is NOT recommended and it's very insecure. (But still an option) Read this document for more description
So the URL would be like https://<user:pass>@github.com/KeteraUK/Strive-Pod-Specs.git
The other option you have is to set a helper application that injects the password in the process. You may already have one configured, but git
may simply not be able to find it. The above document page has information on this option as well. You can cache it globally by git config --global credential.helper cache
or store it permanently by git config credential.helper store
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With