mirror of
https://github.com/webfactory/ssh-agent.git
synced 2026-03-21 02:29:06 +08:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f066a372e | ||
|
|
a45226bfaf | ||
|
|
81d965f2bd | ||
|
|
515d164e78 | ||
|
|
8569bedfe0 | ||
|
|
98f76b1158 |
12
README.md
12
README.md
@@ -33,9 +33,9 @@ jobs:
|
|||||||
...
|
...
|
||||||
steps:
|
steps:
|
||||||
- actions/checkout@v2
|
- 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
|
# action
|
||||||
- uses: webfactory/ssh-agent@v0.5.2
|
- uses: webfactory/ssh-agent@v0.5.3
|
||||||
with:
|
with:
|
||||||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
- ... other steps
|
- ... other steps
|
||||||
@@ -50,7 +50,7 @@ You can set up different keys as different secrets and pass them all to the acti
|
|||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
# ... contens as before
|
# ... contens as before
|
||||||
- uses: webfactory/ssh-agent@v0.5.2
|
- uses: webfactory/ssh-agent@v0.5.3
|
||||||
with:
|
with:
|
||||||
ssh-private-key: |
|
ssh-private-key: |
|
||||||
${{ secrets.FIRST_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.
|
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.
|
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`.
|
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.
|
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
|
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
|
## What this Action *cannot* do for you
|
||||||
|
|
||||||
The following items are not issues, but beyond what this Action is supposed to do.
|
The following items are not issues, but beyond what this Action is supposed to do.
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ runs:
|
|||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'dist/index.js'
|
main: 'dist/index.js'
|
||||||
post: 'dist/cleanup.js'
|
post: 'dist/cleanup.js'
|
||||||
|
post-if: 'always()'
|
||||||
branding:
|
branding:
|
||||||
icon: loader
|
icon: loader
|
||||||
color: 'yellow'
|
color: 'yellow'
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
const { execSync } = require('child_process');
|
const { execFileSync } = require('child_process');
|
||||||
const { sshAgent } = require('./paths.js');
|
const { sshAgent } = require('./paths.js');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Kill the started SSH agent
|
// Kill the started SSH agent
|
||||||
console.log('Stopping SSH agent');
|
console.log('Stopping SSH agent');
|
||||||
execSync(sshAgent, ['-k'], { stdio: 'inherit' });
|
execFileSync(sshAgent, ['-k'], { stdio: 'inherit' });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error.message);
|
console.log(error.message);
|
||||||
console.log('Error stopping the SSH agent, proceeding anyway');
|
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__) {
|
/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
|
||||||
|
|
||||||
const core = __webpack_require__(470);
|
const core = __webpack_require__(470);
|
||||||
const { execSync } = __webpack_require__(129);
|
const { execFileSync } = __webpack_require__(129);
|
||||||
const { sshAgent } = __webpack_require__(972);
|
const { sshAgent } = __webpack_require__(972);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Kill the started SSH agent
|
// Kill the started SSH agent
|
||||||
console.log('Stopping SSH agent');
|
console.log('Stopping SSH agent');
|
||||||
execSync(sshAgent, ['-k'], { stdio: 'inherit' });
|
execFileSync(sshAgent, ['-k'], { stdio: 'inherit' });
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error.message);
|
console.log(error.message);
|
||||||
console.log('Error stopping the SSH agent, proceeding anyway');
|
console.log('Error stopping the SSH agent, proceeding anyway');
|
||||||
|
|||||||
Reference in New Issue
Block a user