Compare commits

...

5 Commits

Author SHA1 Message Date
Wojciech Pawlik f492d87a85
Merge b8a48d8f8e into b4ffde65f4 2023-11-05 23:39:24 +08:00
Cory Miller b4ffde65f4
Link to release page from what's new section (#1514) 2023-10-17 11:52:30 -04:00
Peter Bengtsson 8530928916
Correct link to GitHub Docs (#1511)
No hardcoded language in the URL and uses the correct docs.github.com domain.
2023-10-13 11:07:47 -04:00
Josh Gross 7cdaf2fbc0
Update CODEOWNERS to Launch team (#1510) 2023-10-10 11:16:51 -04:00
Wojciech Pawlik b8a48d8f8e
Set `user.signingKey` to `ssh-key` 2023-04-09 21:14:37 +02:00
5 changed files with 12 additions and 6 deletions

View File

@ -1 +1 @@
* @actions/actions-runtime * @actions/actions-launch

View File

@ -4,7 +4,7 @@
This action checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it. This action checks-out your repository under `$GITHUB_WORKSPACE`, so your workflow can access it.
Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. Set `fetch-depth: 0` to fetch all history for all branches and tags. Refer [here](https://help.github.com/en/articles/events-that-trigger-workflows) to learn which commit `$GITHUB_SHA` points to for different events. Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. Set `fetch-depth: 0` to fetch all history for all branches and tags. Refer [here](https://docs.github.com/actions/using-workflows/events-that-trigger-workflows) to learn which commit `$GITHUB_SHA` points to for different events.
The auth token is persisted in the local git config. This enables your scripts to run authenticated git commands. The token is removed during post-job cleanup. Set `persist-credentials: false` to opt-out. The auth token is persisted in the local git config. This enables your scripts to run authenticated git commands. The token is removed during post-job cleanup. Set `persist-credentials: false` to opt-out.
@ -12,9 +12,7 @@ When Git 2.18 or higher is not in your PATH, falls back to the REST API to downl
# What's new # What's new
- Updated default runtime to node20 Please refer to the [release page](https://github.com/actions/checkout/releases/latest) for the latest release notes.
- This requires a minimum Actions Runner version of [v2.308.0](https://github.com/actions/runner/releases/tag/v2.308.0).
- Added support for fetching without the `--progress` option
# Usage # Usage

View File

@ -295,6 +295,10 @@ describe('git-auth-helper tests', () => {
'core.sshCommand', 'core.sshCommand',
expectedSshCommand expectedSshCommand
) )
expect(git.config).toHaveBeenCalledWith(
'user.signingKey',
actualKeyPath
)
}) })
const configureAuth_writesExplicitKnownHosts = 'writes explicit known hosts' const configureAuth_writesExplicitKnownHosts = 'writes explicit known hosts'

4
dist/index.js vendored
View File

@ -148,6 +148,7 @@ const urlHelper = __importStar(__nccwpck_require__(9437));
const v4_1 = __importDefault(__nccwpck_require__(824)); const v4_1 = __importDefault(__nccwpck_require__(824));
const IS_WINDOWS = process.platform === 'win32'; const IS_WINDOWS = process.platform === 'win32';
const SSH_COMMAND_KEY = 'core.sshCommand'; const SSH_COMMAND_KEY = 'core.sshCommand';
const SIGNING_KEY = 'user.signingKey';
function createAuthHelper(git, settings) { function createAuthHelper(git, settings) {
return new GitAuthHelper(git, settings); return new GitAuthHelper(git, settings);
} }
@ -305,7 +306,7 @@ class GitAuthHelper {
this.sshKeyPath = path.join(runnerTemp, uniqueId); this.sshKeyPath = path.join(runnerTemp, uniqueId);
stateHelper.setSshKeyPath(this.sshKeyPath); stateHelper.setSshKeyPath(this.sshKeyPath);
yield fs.promises.mkdir(runnerTemp, { recursive: true }); yield fs.promises.mkdir(runnerTemp, { recursive: true });
yield fs.promises.writeFile(this.sshKeyPath, this.settings.sshKey.trim() + '\n', { mode: 0o600 }); yield fs.promises.writeFile(this.sshKeyPath, `${this.settings.sshKey.trim()}\n`, { mode: 0o600 });
// Remove inherited permissions on Windows // Remove inherited permissions on Windows
if (IS_WINDOWS) { if (IS_WINDOWS) {
const icacls = yield io.which('icacls.exe'); const icacls = yield io.which('icacls.exe');
@ -346,6 +347,7 @@ class GitAuthHelper {
// Configure core.sshCommand // Configure core.sshCommand
if (this.settings.persistCredentials) { if (this.settings.persistCredentials) {
yield this.git.config(SSH_COMMAND_KEY, this.sshCommand); yield this.git.config(SSH_COMMAND_KEY, this.sshCommand);
yield this.git.config(SIGNING_KEY, this.sshKeyPath);
} }
}); });
} }

View File

@ -14,6 +14,7 @@ import {IGitSourceSettings} from './git-source-settings'
const IS_WINDOWS = process.platform === 'win32' const IS_WINDOWS = process.platform === 'win32'
const SSH_COMMAND_KEY = 'core.sshCommand' const SSH_COMMAND_KEY = 'core.sshCommand'
const SIGNING_KEY = 'user.signingKey'
export interface IGitAuthHelper { export interface IGitAuthHelper {
configureAuth(): Promise<void> configureAuth(): Promise<void>
@ -269,6 +270,7 @@ class GitAuthHelper {
// Configure core.sshCommand // Configure core.sshCommand
if (this.settings.persistCredentials) { if (this.settings.persistCredentials) {
await this.git.config(SSH_COMMAND_KEY, this.sshCommand) await this.git.config(SSH_COMMAND_KEY, this.sshCommand)
await this.git.config(SIGNING_KEY, this.sshKeyPath)
} }
} }