fastlane / fastlane

🚀 The easiest way to automate building and releasing your iOS and Android apps
https://fastlane.tools
MIT License
39.62k stars 5.71k forks source link

Unable to access certificates repo in GitHub Action #20883

Closed zacdemi closed 1 year ago

zacdemi commented 1 year ago

New Issue Checklist

Issue Description

git clone https://github.com/xxxxx/ios-certificates.git /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20221122-954-k39ap0 -c http.extraheader='Authorization: Basic $ {{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}'

^this command works locally, but not inside of GitHub actions. Based on the error message below I would expect a 401 or 403 , but I'm receiving a 400. The MATCH_GIT_BASIC_ATHORIZATION Is a base64 encoded personal access token with the correct read access. The verbose error log below. Is there anything I'm missing? Thanks

Summary of Match

+----------------------------------------+-------------------------------------------------------+ | Summary for match 2.210.1 | +----------------------------------------+-------------------------------------------------------+ | type | adhoc | | username | apps@xxxxx.com | | app_identifier | ["com.xxxx.xxxx.staging"] | | git_url | https://github.com/xxxxx/ios-certificates.git | | git_basic_authorization | **** | | readonly | false | | generate_apple_certs | true | | skip_provisioning_profiles | false | | team_id | XXXXXXXX | | storage_mode | git | | git_branch | master | | shallow_clone | false | | clone_branch_directly | false | | skip_google_cloud_account_confirmation | false | | keychain_name | login.keychain | | force | false | | force_for_new_devices | false | | include_all_certificates | false | | force_for_new_certificates | false | | skip_confirmation | false | | safe_remove_certs | false | | skip_docs | false | | platform | ios | | derive_catalyst_app_identifier | false | | fail_on_name_taken | false | | skip_certificate_matching | false | | skip_set_partition_list | false | | verbose | false | +----------------------------------------+-------------------------------------------------------+

Command executed

fastlane staging

Complete output when running fastlane, including the stack trace and command used
INFO [2022-11-22 21:09:37.17]: Cloning remote git repo...
INFO [2022-11-22 21:09:37.17]: If cloning the repo takes too long, you can use the `clone_branch_directly` option in match.
INFO [2022-11-22 21:09:37.17]: $ git clone https://github.com/xxxxx/ios-certificates.git /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20221122-954-k39ap0 -c http.extraheader='Authorization: Basic $ {{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}'
INFO [2022-11-22 21:09:37.25]: ▸ Cloning into '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20221122-954-k39ap0'...
INFO [2022-11-22 21:09:37.39]: ▸ fatal: unable to access 'https://github.com/xxxxx/ios-certificates.git/': The requested URL returned error: 400
Cloning into '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20221122-[95](https://github.com/xxxxx-mobile/actions/runs/3527005134/jobs/5915791874#step:3:96)4-k39ap0'...
fatal: unable to access 'https://github.com/xxxxx/ios-certificates.git/': The requested URL returned error: 400
ERROR [2022-11-22 21:09:37.39]: Exit status: 128
ERROR [2022-11-22 21:09:37.39]: Error cloning certificates repo, please make sure you have read access to the repository you want to use
ERROR [2022-11-22 21:09:37.39]: Run the following command manually to make sure you're properly authenticated:
INFO [2022-11-22 21:09:37.39]: $ git clone https://github.com/xxxxx/ios-certificates.git /var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20221122-954-k39ap0 -c http.extraheader='Authorization: Basic $ {{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}'
WARN [2022-11-22 21:09:37.39]: Lane Context:
INFO [2022-11-22 21:09:37.39]: {:DEFAULT_PLATFORM=>:ios, :PLATFORM_NAME=>:ios, :LANE_NAME=>"ios staging"}
ERROR [2022-11-22 21:09:37.39]: Error cloning certificates git repo, please make sure you have access to the repository - see instructions above
 [REPLACE THIS WITH YOUR INFORMATION] 

Environment

Stack

Key Value
OS 12.5
Ruby 3.1.2
Bundler? false
Git git version 2.37.0 (Apple Git-136)
Installation Source /opt/homebrew/Cellar/fastlane/2.211.0/libexec/bin/fastlane
Host macOS 12.5 (21G72)
Ruby Lib Dir /opt/homebrew/Cellar/ruby/3.1.2_1/lib
OpenSSL Version OpenSSL 1.1.1q 5 Jul 2022
Is contained false
Is homebrew true
Is installed via Fabric.app false
Xcode Path /Applications/Xcode.app/Contents/Developer/
Xcode Version 14.0
Swift Version 5.7

fastlane gems

Gem Version Update-Status
fastlane 2.211.0 ✅ Up-To-Date

Loaded fastlane plugins:

Plugin Version Update-Status
fastlane-plugin-appcenter 2.0.0 ✅ Up-To-Date
 [REPLACE THIS WITH YOUR INFORMATION] 
zacdemi commented 1 year ago

If you have this error its probably a typo somewhere with your GitHub secrets. Here was my typo - see extra space below after the dollar sign.

name: build-ios-staging
on:
  push:
    branches:
      - "staging"
jobs:
  build:
    runs-on: macos-latest
    environment: staging_environment
    steps:
      - name: Deploy iOS staging to AppCenter via Fastlane
        uses: actions/checkout@v3
      - run: yarn fastlane:ios:staging
        env:
          MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
          APP_CENTER_ACCESS_TOKEN: ${{ secrets.APP_CENTER_ACCESS_TOKEN }}
          MATCH_GIT_BASIC_AUTHORIZATION: $ {{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}

should be

MATCH_GIT_BASIC_AUTHORIZATION: ${{ secrets.MATCH_GIT_BASIC_AUTHORIZATION }}
ascentman commented 8 months ago

I had the same error. But what helped me is to switch to ssh instead of https in Matchfile and using webfactory/ssh-agent (https://github.com/marketplace/actions/webfactory-ssh-agent) and setting: SSH_PRIVATE_KEY in repo secrets variables.

Richie911 commented 3 months ago

make sure to check if the PAT has expired or if you have regenerated it you will need to reconvert to base 64