PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, September 26, 2022

[FIXED] What do I need to do to clone a repo within the same org within a Github Actions workflow?

 September 26, 2022     continuous-deployment, continuous-integration, deployment, github, github-actions     No comments   

Issue

Does anyone have experience with Github Actions? Within a Github Actions workflow, I am trying to clone another internal repo within the same org. I am doing the below.

- name: Install SSH Key
  uses: webfactory/ssh-agent@v0.5.4
  with:
        ssh-private-key: ${{ secrets.ACCESS_KEY }}

- name: Clone the internal repo
  uses: actions/checkout@v3
  with:
        repository: '[org name]/[repo name]'
        path: [my path]
        token: ${{ secrets.ACCESS_KEY }}

The Access_Key is a private key stored in the repo's secrets. The public part of the key is added to the internal repo (the repo I am trying to clone) as a deploy key.

The first step completes successfully, but it does log this:

Comment for (public) key ' ' does not match GitHub URL pattern. Not treating it as a GitHub deploy key.

The second step fails with this error:

token ... is not a legal HTTP header value

I'm not sure if the comment from the first step is causing a failure in the second or not. But I can't seem to fix either. Nor can I find really any documentation online to fix either of these. Does anyone have any ideas, advice, or experience with Github Actions, deploy keys, etc?


Solution

  1. Create a new secret containing GitHub access token with read permissions to the target repository
  2. Use that token inside of your workflow (instead of GITHUB_TOKEN)
- uses: actions/checkout@v3
  with:
    repository: '[org name]/[repo name]'
    path: [my path]
    token: ${{ secrets.GITHUB_AUTH_TOKEN }}

Alternatively, you can add another repo as Git submodule to the main repo.

- uses: actions/checkout@v3
  with:
    submodules: '[submodules]'


Answered By - Konstantin Tarkus
Answer Checked By - David Goodson (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing