Merged
Conversation
Co-authored-by: GochoMugo <4707579+GochoMugo@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix SSH key setup error in workflow file
Remove invalid secrets context from workflow conditional
Dec 6, 2025
Owner
|
@copilot Fix the following error when git cloning using a SSH url |
Co-authored-by: GochoMugo <4707579+GochoMugo@users.noreply.github.com>
Co-authored-by: GochoMugo <4707579+GochoMugo@users.noreply.github.com>
Contributor
Author
Copilot
AI
changed the title
Remove invalid secrets context from workflow conditional
Fix workflow SSH configuration errors
Dec 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes two issues with the GitHub Actions workflow:
secretscontext inifconditionals. The workflow failed with:Changes
if: secrets.SSH_PRIVATE_KEY != ''from the "Setup SSH key" step - thewebfactory/ssh-agentaction handles missing secrets gracefully, making the conditional unnecessary~/.ssh/known_hostswith host keys for GitHub, GitLab, and Bitbucket usingssh-keyscan|| trueto gracefully handle failures for individual hosts-Hflag to hash hostnames for additional privacy- name: Checkout repository uses: actions/checkout@v4 + - name: Setup SSH known hosts + run: | + mkdir -p ~/.ssh + # Add known hosts for common Git hosting services + ssh-keyscan -H github.com >> ~/.ssh/known_hosts 2>/dev/null || true + ssh-keyscan -H gitlab.com >> ~/.ssh/known_hosts 2>/dev/null || true + ssh-keyscan -H bitbucket.org >> ~/.ssh/known_hosts 2>/dev/null || true + - name: Setup SSH key - if: secrets.SSH_PRIVATE_KEY != '' uses: webfactory/ssh-agent@v0.9.0 with: ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}These changes ensure the workflow can successfully clone repositories via SSH without host key verification failures.
Original prompt
This pull request was created as a result of the following prompt from Copilot chat.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.