Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enhance log message #383

Merged
merged 4 commits into from
Jul 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"git.ignoreLimitWarning": true
"git.ignoreLimitWarning": true,
"deno.enable": false
}
5 changes: 4 additions & 1 deletion __tests__/set-tokens.test.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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