Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Shohei Ueda authored and GitHub committed Jul 8, 2020
1 parent 31cdbe5 commit 2e97684
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
@@ -1,3 +1,4 @@
{
"git.ignoreLimitWarning": true
"git.ignoreLimitWarning": true,
"deno.enable": false
}
5 changes: 4 additions & 1 deletion __tests__/set-tokens.test.ts
Expand Up @@ -63,7 +63,10 @@ describe('setGithubToken()', () => {
'refs/heads/master',
'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', () => {
Expand Down
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion src/set-tokens.ts
Expand Up @@ -44,6 +44,11 @@ Host github
await exec.exec('chmod', ['600', sshConfigPath]);

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('sh', ['-c', '\'eval "$(ssh-agent)"\''], {shell: true});
await exec.exec('sc', ['config', 'ssh-agent', 'start=auto']);
Expand Down Expand Up @@ -71,7 +76,10 @@ export function setGithubToken(
let isProhibitedBranch = false;

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') {
Expand Down

0 comments on commit 2e97684

Please sign in to comment.