Luk*_*e97 4 xcode github cocoapods github-actions
我正在尝试在我的工作流脚本上安装我的依赖项。但是,有些是私人豆荚,当我尝试这样做时,它给了我这个错误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.
Run Code Online (Sandbox Code Playgroud)
pod repo add...
导致此错误:fatal: could not read Username for 'https://github.com': Device not configured
即使我添加了我的个人访问令牌(秘密)。
这是我的完整脚本:
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.
Run Code Online (Sandbox Code Playgroud)
如何使用我的工作流 GitHub 操作脚本安装私有 Pod?
注意:我也在尝试通过一个组织来做到这一点。
您尚未在pod repo add https://github...
命令中提供 API 令牌,并且很可能因此而失败。请将您的个人 API 令牌添加到 github url 中,如<token>@github.com
. 您可以使用secrets
和env
来做同样的事情。
很可能以下内容应该有助于传递您遇到的错误:
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 }}
Run Code Online (Sandbox Code Playgroud)
修改后的行是:
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 }}
Run Code Online (Sandbox Code Playgroud)
确保使用您的个人访问令牌定义一个秘密的 POD_GITHUB_API_TOKEN。