mirror of
https://github.com/webfactory/ssh-agent.git
synced 2026-03-16 00:09:06 +08:00
Compare commits
7 Commits
v0.5.2
...
demo-go-ge
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d1843b70e | ||
|
|
5f066a372e | ||
|
|
a45226bfaf | ||
|
|
81d965f2bd | ||
|
|
515d164e78 | ||
|
|
8569bedfe0 | ||
|
|
98f76b1158 |
1
.github/workflows/demo.yml
vendored
1
.github/workflows/demo.yml
vendored
@@ -22,6 +22,7 @@ jobs:
|
||||
git clone https://github.com/mpdude/test-2.git test-2-http
|
||||
git clone git@github.com:mpdude/test-2.git test-2-git
|
||||
git clone ssh://git@github.com/mpdude/test-2.git test-2-git-ssh
|
||||
go get -v github.com/mpdude/test-2
|
||||
|
||||
docker_demo:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
12
README.md
12
README.md
@@ -33,9 +33,9 @@ jobs:
|
||||
...
|
||||
steps:
|
||||
- actions/checkout@v2
|
||||
# Make sure the @v0.5.2 matches the current version of the
|
||||
# Make sure the @v0.5.3 matches the current version of the
|
||||
# action
|
||||
- uses: webfactory/ssh-agent@v0.5.2
|
||||
- uses: webfactory/ssh-agent@v0.5.3
|
||||
with:
|
||||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
- ... other steps
|
||||
@@ -50,7 +50,7 @@ You can set up different keys as different secrets and pass them all to the acti
|
||||
|
||||
```yaml
|
||||
# ... contens as before
|
||||
- uses: webfactory/ssh-agent@v0.5.2
|
||||
- uses: webfactory/ssh-agent@v0.5.3
|
||||
with:
|
||||
ssh-private-key: |
|
||||
${{ secrets.FIRST_KEY }}
|
||||
@@ -68,7 +68,7 @@ When using **Github deploy keys**, GitHub servers will accept the _first_ known
|
||||
|
||||
To support picking the right key in this use case, this action scans _key comments_ and will set up extra Git and SSH configuration to make things work.
|
||||
|
||||
1. When creating the deploy key for a repository like `git@github.com:owner/repo.git` or `https://github.com/owner/repo`, put that URL into the key comment.
|
||||
1. When creating the deploy key for a repository like `git@github.com:owner/repo.git` or `https://github.com/owner/repo`, put that URL into the key comment. (Hint: Try `ssh-keygen ... -C "git@github.com:owner/repo.git"`.)
|
||||
2. After keys have been added to the agent, this action will scan the key comments.
|
||||
3. For key comments containing such URLs, a Git config setting is written that uses [`url.<base>.insteadof`](https://git-scm.com/docs/git-config#Documentation/git-config.txt-urlltbasegtinsteadOf). It will redirect `git` requests to URLs starting with either `https://github.com/owner/repo` or `git@github.com:owner/repo` to a fake hostname/URL like `git@...some.hash...:owner/repo`.
|
||||
4. An SSH configuration section is generated that applies to the fake hostname. It will map the SSH connection back to `github.com`, while at the same time pointing SSH to a file containing the appropriate key's public part. That will make SSH use the right key when connecting to GitHub.com.
|
||||
@@ -126,6 +126,10 @@ env:
|
||||
CARGO_NET_GIT_FETCH_WITH_CLI: true
|
||||
```
|
||||
|
||||
### Using Deploy Keys with Swift Package Manager
|
||||
|
||||
`xcodebuild` by default uses Xcode's built-in Git tooling. If you want to use GitHub Deploy Keys as supported by this action, however, that version of Git will lack the necessary URL remapping. In this case, pass `-scmProvider system` to the `xcodebuild` command, as mentioned in [Apple's documentation](https://developer.apple.com/documentation/swift_packages/building_swift_packages_or_apps_that_use_them_in_continuous_integration_workflows#3680255).
|
||||
|
||||
## What this Action *cannot* do for you
|
||||
|
||||
The following items are not issues, but beyond what this Action is supposed to do.
|
||||
|
||||
@@ -10,6 +10,7 @@ runs:
|
||||
using: 'node12'
|
||||
main: 'dist/index.js'
|
||||
post: 'dist/cleanup.js'
|
||||
post-if: 'always()'
|
||||
branding:
|
||||
icon: loader
|
||||
color: 'yellow'
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
const core = require('@actions/core');
|
||||
const { execSync } = require('child_process');
|
||||
const { execFileSync } = require('child_process');
|
||||
const { sshAgent } = require('./paths.js');
|
||||
|
||||
try {
|
||||
// Kill the started SSH agent
|
||||
console.log('Stopping SSH agent');
|
||||
execSync(sshAgent, ['-k'], { stdio: 'inherit' });
|
||||
|
||||
execFileSync(sshAgent, ['-k'], { stdio: 'inherit' });
|
||||
} catch (error) {
|
||||
console.log(error.message);
|
||||
console.log('Error stopping the SSH agent, proceeding anyway');
|
||||
|
||||
5
dist/cleanup.js
vendored
5
dist/cleanup.js
vendored
@@ -123,14 +123,13 @@ module.exports = require("child_process");
|
||||
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
|
||||
|
||||
const core = __webpack_require__(470);
|
||||
const { execSync } = __webpack_require__(129);
|
||||
const { execFileSync } = __webpack_require__(129);
|
||||
const { sshAgent } = __webpack_require__(972);
|
||||
|
||||
try {
|
||||
// Kill the started SSH agent
|
||||
console.log('Stopping SSH agent');
|
||||
execSync(sshAgent, ['-k'], { stdio: 'inherit' });
|
||||
|
||||
execFileSync(sshAgent, ['-k'], { stdio: 'inherit' });
|
||||
} catch (error) {
|
||||
console.log(error.message);
|
||||
console.log('Error stopping the SSH agent, proceeding anyway');
|
||||
|
||||
Reference in New Issue
Block a user