Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GET repo keys cURL returning "404" #5

Open
kstdivelbiss opened this issue Jun 30, 2022 · 1 comment
Open

GET repo keys cURL returning "404" #5

kstdivelbiss opened this issue Jun 30, 2022 · 1 comment

Comments

@kstdivelbiss
Copy link

kstdivelbiss commented Jun 30, 2022

I'm attempting to use fastlane match to manage my certs and I haven't been able to get it to work properly.

I have been following the instructions on your blog https://www.joshholtz.com/blog/2020/05/19/fastlane-plugin-for-setting-up-github-actions.html and have set everything up as instructed but when I run the action I get

    [15:47:40]: ---------------------------
    [15:47:40]: --- Step: github_action ---
    [15:47:40]: ---------------------------
    [15:47:40]: The github_actions plugin is working!
    [15:47:41]: ---
    [15:47:41]: Request failed:
    GET: https://api.github.com/repos/***/keys
    [15:47:41]: Headers:
    {"User-Agent"=>"fastlane-github_api", "Authorization"=>"Basic ***"}
    [15:47:41]: ---
    [15:47:41]: Response:
    [15:47:41]: {"message":"Not Found","documentation_url":"https://docs.github.com/rest/reference/repos#list-deploy-keys"}

I have checked and the org and repo variables are correct, my yml looks like this:

    jobs:
      setup:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/[email protected]
          - uses: ruby/setup-ruby@v1
            with:
              ruby-version: 2.6
              bundler-cache: true
    
          - name: Build iOS
            shell: bash
            run: |
              bundle exec fastlane ios init_ci
            env:
              APP_STORE_CONNECT_ISSUER_ID: ${{ secrets.IOS_DEV_APPSTORE_ISSUER_ID }}
              APP_STORE_CONNECT_KEY: ${{ secrets.IOS_DEV_APPSTORE_P8 }}
              APP_STORE_CONNECT_KEY_ID: ${{ secrets.IOS_DEV_APPSTORE_KEY_ID }}
    
              GH_PAT: ${{ secrets.PAT_VALUE }}
              GITHUB_REPOSITORY: ${{ env.GITHUB_REPOSITORY }}
              MATCH_REPOSITORY: ${{ secrets.MATCH_REPOSITORY }}

And the init_ci in my fastfile looks like this:

      org, repo = (ENV["GITHUB_REPOSITORY"]||"").split("/")
      match_org, match_repo = (ENV["MATCH_REPOSITORY"]||"").split("/")
      
      platform :ios do
        lane :init_ci do
          setup_ci
          github_action(
            api_token: ENV["GH_PAT"],
            org: org,
            repo: repo,
            match_org: match_org,
            match_repo: match_repo,
            writable_deploy_key: true
          )
        end

my github PAT is set up for repo, workflow, and even admin privileges and is being accessed.
Was there a change to the github api? the "list_deploy_keys" is no longer a part of the github API documentation that the error is linking to

@darngeek
Copy link

I know its probably too late; but I had the same issue and was able to resolve this by verifying the following;

The account you've used to generate the GH_PAT access token on, needs to have rights to list deploy keys.
using GitHub CLI I was able to find out my owner account could list them, but the account I used for automation wasn't.

checking the documentation: repository-roles-for-an-organization turns out to do so, the account needs the Admin Role on your project repository where its trying to list the deploy keys.
(which I guess makes sense because a write deploy key could do the same)

TLDR;
give the account that owns the GH_PAT the admin role for the GITHUB_REPOSITORY.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants