Skip to content
This repository has been archived by the owner on Aug 15, 2024. It is now read-only.

Commit

Permalink
feat: support proxy configuration (#621)
Browse files Browse the repository at this point in the history
support proxy configuration
  • Loading branch information
liweiyi88 authored Nov 9, 2022
1 parent 27bceaf commit 714f07f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ Automate releases with Conventional Commit Messages.
| `group-pull-request-title-pattern` | sets the manifest pull request title for when releasing multiple packages grouped together in the one pull request |
| `release-search-depth` | when searching for the latest release SHAs, only consider the last N releases |
| `commit-search-depth` | when fetching the list of commits to consider, only consider the last N commits |
| `proxy-server` | set proxy sever when you run this action behind a proxy. format is host:port e.g. proxy-host.com:8080 |

## GitHub credentials

Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ inputs:
commit-search-depth:
description: 'when fetching the list of commits to consider, only consider the last N commits'
required: false
proxy-server:
description: 'set proxy sever when you run this action behind a proxy. format is host:port e.g. proxy-host.com:8080'
required: false

runs:
using: 'node16'
Expand Down
12 changes: 10 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function getGitHubInput () {
repoUrl: core.getInput('repo-url') || process.env.GITHUB_REPOSITORY,
apiUrl: core.getInput('github-api-url') || GITHUB_API_URL,
graphqlUrl: (core.getInput('github-graphql-url') || '').replace(/\/graphql$/, '') || GITHUB_GRAPHQL_URL,
token: core.getInput('token', { required: true })
token: core.getInput('token', { required: true }),
proxyServer: core.getInput('proxy-server') || undefined
}
}

Expand Down Expand Up @@ -112,9 +113,16 @@ const releasePlease = {
}

function getGitHubInstance () {
const { token, defaultBranch, apiUrl, graphqlUrl, repoUrl } = getGitHubInput()
const { token, defaultBranch, apiUrl, graphqlUrl, repoUrl, proxyServer } = getGitHubInput()
const [owner, repo] = repoUrl.split('/')

let proxy
if (proxyServer) {
const [host, port] = proxyServer.split(':')
proxy = { host, port }
}
const githubCreateOpts = {
proxy,
owner,
repo,
apiUrl,
Expand Down
12 changes: 10 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ function getGitHubInput () {
repoUrl: core.getInput('repo-url') || process.env.GITHUB_REPOSITORY,
apiUrl: core.getInput('github-api-url') || GITHUB_API_URL,
graphqlUrl: (core.getInput('github-graphql-url') || '').replace(/\/graphql$/, '') || GITHUB_GRAPHQL_URL,
token: core.getInput('token', { required: true })
token: core.getInput('token', { required: true }),
proxyServer: core.getInput('proxy-server') || undefined
}
}

Expand Down Expand Up @@ -105,9 +106,16 @@ const releasePlease = {
}

function getGitHubInstance () {
const { token, defaultBranch, apiUrl, graphqlUrl, repoUrl } = getGitHubInput()
const { token, defaultBranch, apiUrl, graphqlUrl, repoUrl, proxyServer } = getGitHubInput()
const [owner, repo] = repoUrl.split('/')

let proxy
if (proxyServer) {
const [host, port] = proxyServer.split(':')
proxy = { host, port }
}
const githubCreateOpts = {
proxy,
owner,
repo,
apiUrl,
Expand Down

0 comments on commit 714f07f

Please sign in to comment.