feat: enhance log message (#383)

Add warning deploy_key on windows-latest
- Currently, the deploy_key option is not supported on the windows-latest.
- Related #87

Close #359
This commit is contained in:
Shohei Ueda 2020-07-09 05:15:51 +09:00 committed by GitHub
parent 31cdbe5222
commit 2e976845a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 6 deletions

View File

@ -1,3 +1,4 @@
{ {
"git.ignoreLimitWarning": true "git.ignoreLimitWarning": true,
"deno.enable": false
} }

View File

@ -63,7 +63,10 @@ describe('setGithubToken()', () => {
'refs/heads/master', 'refs/heads/master',
'push' 'push'
); );
}).toThrowError('GITHUB_TOKEN does not support to push to an external repository'); }).toThrowError(`\
The generated GITHUB_TOKEN (github_token) does not support to push to an external repository.
Use deploy_key or personal_token.
`);
}); });
test('return remote url with GITHUB_TOKEN pull_request', () => { test('return remote url with GITHUB_TOKEN pull_request', () => {

6
package-lock.json generated
View File

@ -6994,9 +6994,9 @@
} }
}, },
"lodash": { "lodash": {
"version": "4.17.15", "version": "4.17.19",
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.19.tgz",
"integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", "integrity": "sha512-JNvd8XER9GQX0v2qJgsaN/mzFCNA5BRe/j8JN9d+tWyGLSodKQHKFicdwNYzWwI3wjRnaKPsGj1XkBjx/F96DQ==",
"dev": true "dev": true
}, },
"lodash._reinterpolate": { "lodash._reinterpolate": {

View File

@ -44,6 +44,11 @@ Host github
await exec.exec('chmod', ['600', sshConfigPath]); await exec.exec('chmod', ['600', sshConfigPath]);
if (process.platform === 'win32') { if (process.platform === 'win32') {
core.warning(`\
Currently, the deploy_key option is not supported on the windows-latest.
Watch https://github.com/peaceiris/actions-gh-pages/issues/87
`);
await cpSpawnSync('Start-Process', ['powershell.exe', '-Verb', 'runas']); await cpSpawnSync('Start-Process', ['powershell.exe', '-Verb', 'runas']);
await cpSpawnSync('sh', ['-c', '\'eval "$(ssh-agent)"\''], {shell: true}); await cpSpawnSync('sh', ['-c', '\'eval "$(ssh-agent)"\''], {shell: true});
await exec.exec('sc', ['config', 'ssh-agent', 'start=auto']); await exec.exec('sc', ['config', 'ssh-agent', 'start=auto']);
@ -71,7 +76,10 @@ export function setGithubToken(
let isProhibitedBranch = false; let isProhibitedBranch = false;
if (externalRepository) { if (externalRepository) {
throw new Error('GITHUB_TOKEN does not support to push to an external repository'); throw new Error(`\
The generated GITHUB_TOKEN (github_token) does not support to push to an external repository.
Use deploy_key or personal_token.
`);
} }
if (eventName === 'push') { if (eventName === 'push') {