Garden and Github Actions ? Pull sources from same...
# 🌱|help-and-getting-started
b
Hey folks, I wanted to ask you a question related to garden and github actions. Here is what i have: 1.
project.garden.yml
with three other repos on github linked as
sources
.
sources[].repositoryUrl
is github
ssh
protocol (
git@github.com:owner/repo.git
) 2. we run
garden deploy
on github actions to deploy to test, dev, prod environments and also on local machine for local development in dev clusters. Now my question is, does anyone here has any experience in getting garden to pull sources on Github Actions runners from other repos in the same organization? For my purposes, I don't want to use ssh keys on the runners or use PATs to authenticate the github org. I decided to GitHub apps, which is installed on all repos and I get a short lived token while running the workflow. I would like to use this token to configure the git client on the runner and then make garden pull sources without running into auth issues. However I haven't been able to get it working.
b
Hi @breezy-queen-93424 you should be able to do this by altering the git config before running the Garden command in your github action instance as a preceding step. something like this command might do the trick:
Copy code
git config --global url."https://oauth2:${{ secrets.GITHUB_TOKEN }}@github.com".insteadOf https://github.com
b
@big-spring-14945 Thanks, I am doing something similar,
Copy code
- name: Rewrite SSH to HTTPS for GitHub URLs
      shell: bash
      run: |
        git config --global http.https://github.com/.extraheader "AUTHORIZATION: bearer ${GH_APP_TOKEN}"
        git config --global url."https://github.com/".insteadOf git@github.com:
        git config --global url."https://github.com/".insteadOf ssh://git@github.com/
But garden still ends up using ssh. Let me try using
oauth2
in the url scheme. Thanks for answering.
Worked, both with
oauth2
and
x-access-token
. Thanks @big-spring-14945
b
Happy to hear it helped!
2 Views