Want to create a pull request for another repository using deploy key in GitHub Actions

I want to set the deploy key in Repository A, change the code of Repository A in GitHub Actions of Repository B, and send PR.
I think it is possible by using the gh pr create command.

However, gh auth login fails.


    - name: Pull Request
      run: |
        echo $MY_GITHUB_TOKEN | gh auth login --with-token 
        gh pr create -H "branch1" -B "main" -t "pr title" -b "body"

error message

error validating token: HTTP 401: Bad credentials (https://api.github.com/)
Try authenticating with:  gh auth login


I think it is possible because there is an answer that it can be created by looking at the following.

Can you clarify what kind of key you’re trying to use with gh? A deploy key is an SSH key, you can’t use that instead of a token for gh.

comment thanks.

deploy key is ssh key.
The keys are described below.

Does this mean that it is not possible to create a pull request using this key?

Is there any way other than PAT to create pull requests to other repositories on GitHub Actions?
We prefer to use methods that are not tied to individuals.


An app with proper authorization should be able to do that, but it’s not something I’ve tried myself. Here’s the docs link if you want to look into it: