Skip to content

Commit 5055fba

Browse files
committed
fix: add an extra step to load ssh setup
1 parent c891b2a commit 5055fba

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

.github/workflows/sbom.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,29 @@ jobs:
2121
ssh-key: ${{ secrets.DEPLOYMENT_SSH_KEY_TEST }}
2222
persist-credentials: false
2323

24+
- name: Start SSH agent and add key
25+
run: |
26+
# Create the SSH directory if it doesn't exist
27+
mkdir -p ~/.ssh
28+
29+
# Save the private SSH key from the secret into a file
30+
echo "${{ secrets.DEPLOYMENT_SSH_KEY_TEST }}" > ~/.ssh/id_rsa
31+
32+
# Set correct permissions for the private key
33+
chmod 600 ~/.ssh/id_rsa
34+
35+
# Start the SSH agent in the background
36+
eval "$(ssh-agent -s)"
37+
38+
# Add the private key to the SSH agent
39+
ssh-add ~/.ssh/id_rsa
40+
41+
# Add GitHub's public SSH keys to known_hosts to prevent host verification prompts
42+
ssh-keyscan github.com >> ~/.ssh/known_hosts
43+
44+
# Test the SSH connection to GitHub (this will fail gracefully if not successful)
45+
ssh -o StrictHostKeyChecking=no -T git@github.com || true
46+
2447
- name: Check SSH push permissions (dry-run)
2548
run: |
2649
git remote set-url origin git@github.com:${{ github.repository }}.git

0 commit comments

Comments
 (0)