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

Support for ssh remote workflows (and actions) or using git config #1588

Closed
mbrancato opened this issue Jan 29, 2023 · 4 comments · Fixed by #1784
Closed

Support for ssh remote workflows (and actions) or using git config #1588

mbrancato opened this issue Jan 29, 2023 · 4 comments · Fixed by #1784
Labels
kind/feature-request New feature or request

Comments

@mbrancato
Copy link

mbrancato commented Jan 29, 2023

Act version

act version 0.2.40-14-g932863b

Feature description

I'm using a build from master that contains the new feature for remote workflows. The remote workflows are hard coded to use HTTPS, and I need SSH support.

return fmt.Sprintf("https://%s/%s/%s", r.URL, r.Org, r.Repo)

Normally I would use the insteadOf config to fix this but it didn't seem to work.

git config --global url."ssh://git@github.com/".insteadOf "https://github.com/"
% act pull_request
[build-test-release.yaml/MyWorkflow]   ☁  git clone 'https://github.com/myorg/reusable-workflows' # ref=my_branch
[build-test-release.yaml/MyWorkflow] Unable to clone https://github.com/myorg/reusable-workflows refs/heads/my_branch: authentication required
Error: authentication required

However, if I manually clone it, the insteadOf config works fine. I noticed the clone is not run in a container, so I'm not sure if it is otherwise ignoring the global git config.

% git clone 'https://github.com/myorg/reusable-workflows'
Cloning into 'reusable-workflows'...
remote: Enumerating objects: 1183, done.
remote: Counting objects: 100% (360/360), done.
...
@mbrancato mbrancato added the kind/feature-request New feature or request label Jan 29, 2023
@mbrancato
Copy link
Author

a workaround for this is to manually checkout the repo, then checkout the ref.

git clone https://github.com/{{org}}/{{repo}} ~/.cache/act/{{org}-{{repo}}-.github-workflows-{{workflow_filename}}@{{ ref | replace("/", "-")}}/
cd ~/.cache/act/{{org}-{{repo}}-.github-workflows-{{workflow_filename}}.yaml@{{ ref | replace("/", "-")}}/
git checkout {{ref}}

@mbrancato mbrancato changed the title Support for ssh remote workflows or using git config Support for ssh remote workflows (and actions) or using git config Jan 30, 2023
@mbrancato
Copy link
Author

I noticed this is lacking for remote actions as well that require SSH. The workaround does not work for the remote actions.

@qbx2
Copy link

qbx2 commented Feb 8, 2023

By the way, why does not act clone using GITHUB_TOKEN ? gh-cli already supports to clone using GITHUB_TOKEN. https://cli.github.com/manual/gh_repo_clone

EDIT: My bad, I just had to do act -s GITHUB_TOKEN=$GITHUB_TOKEN

@marcelarie
Copy link

marcelarie commented Oct 25, 2023

act -s GITHUB_TOKEN=$GITHUB_TOKEN does not work for me.

It returns:

WARN  ⚠ You are using Apple M-series chip and you have not specified container architecture, you might encounter issues while running act. If so, try running it with '--container-architecture linux/amd64'. ⚠
[qa/🕵️ Quality Assurance/🕵️ Quality Assurance          ]   ☁  git clone 'https://github.com/stuartapp/mc-gh-actions' # ref=main
[qa/🕵️ Quality Assurance/🕵️ Quality Assurance          ] Unable to clone https://github.com/stuartapp/mc-gh-actions refs/heads/main: authorization failed
Error: authorization failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature-request New feature or request
Projects
None yet
3 participants