fix: support github server url for pushing to fork (#1318)

* feat: support github server url for pushing to fork (#1315)

Co-authored-by: Kevin Zhu <kevin.zhu@sap.com>

* fix: code formatting

* test: fix tests for getRemoteUrl

Co-authored-by: MildC <kevin.xizhu@gmail.com>
Co-authored-by: Kevin Zhu <kevin.zhu@sap.com>
This commit is contained in:
Peter Evans 2022-11-24 11:52:04 +09:00 committed by GitHub
parent d7db273d6c
commit 331d02c7e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 16 deletions

View file

@ -90,11 +90,28 @@ describe('utils tests', () => {
})
test('getRemoteUrl successfully returns remote URLs', async () => {
const url1 = utils.getRemoteUrl('HTTPS', 'peter-evans/create-pull-request')
const url1 = utils.getRemoteUrl(
'HTTPS',
'github.com',
'peter-evans/create-pull-request'
)
expect(url1).toEqual('https://github.com/peter-evans/create-pull-request')
const url2 = utils.getRemoteUrl('SSH', 'peter-evans/create-pull-request')
const url2 = utils.getRemoteUrl(
'SSH',
'github.com',
'peter-evans/create-pull-request'
)
expect(url2).toEqual('git@github.com:peter-evans/create-pull-request.git')
const url3 = utils.getRemoteUrl(
'HTTPS',
'mygithubserver.com',
'peter-evans/create-pull-request'
)
expect(url3).toEqual(
'https://mygithubserver.com/peter-evans/create-pull-request'
)
})
test('secondsSinceEpoch returns the number of seconds since the Epoch', async () => {