Skip to content

Commit

Permalink
Merge pull request #2 from port-labs/self_hosted_support
Browse files Browse the repository at this point in the history
added self hosted support
  • Loading branch information
danielsinai authored Oct 22, 2023
2 parents 7ab31a3 + bbd8971 commit c305b61
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ In addition, as cookiecutter is an Open Source project you can make your own pro
| Input | Description | Required | Default |
|-----------------------|-------------------------------------------------------------------------------------------------------------------------------|----------|-----------|
| token | The GitHub Token to use to authenticate with the API with permissions to create repositories within the organization make sure to use [Fine-grained token](https://github.com/settings/tokens?type=beta) | Yes | |
| portClientId | The Port Client ID to use to authenticate with the API | Yes | |
| portClientSecret | The Port Client Secret to use to authenticate with the API | Yes | |
| blueprintIdentifier | The blueprint identifier to use to populate the Port | Yes | Service |
| repositoryName | The name of the repository to create | Yes | |
| organizationName | The name of the organization to create the repository in | Yes | |
| cookiecutterTemplate | The cookiecutter template to use to populate the repository | Yes | |
| portUserInputs | Port user inputs to came from triggering the action | Yes | |
| portRunId | Port run ID to came from triggering the action | Yes | |
| monorepoUrl | If using scaffolding within a monorepo specify the URL here | Yes | |
| scaffoldDirectory | Root folder to scaffold when using monorepo | Yes | |
| portClientId | The Port Client ID to use to authenticate with the API | Yes | |
| portClientSecret | The Port Client Secret to use to authenticate with the API | Yes | |
| blueprintIdentifier | The blueprint identifier to use to populate the Port | Yes | Service |
| repositoryName | The name of the repository to create | Yes | |
| organizationName | The name of the organization to create the repository in | Yes | |
| cookiecutterTemplate | The cookiecutter template to use to populate the repository | Yes | |
| portUserInputs | Port user inputs to came from triggering the action | Yes | |
| portRunId | Port run ID to came from triggering the action | Yes | |
| monorepoUrl | If using scaffolding within a monorepo specify the URL here | Yes | |
| scaffoldDirectory | Root folder to scaffold when using monorepo | Yes | |
| githubURL | GitHub url for self hosted version | Yes |https://api.github.com|

## Quickstart - Scaffold Golang Template

Expand Down
4 changes: 4 additions & 0 deletions action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ inputs:
portUserInputs:
description: 'Port user inputs to came from triggering the action'
required: true
githubURL:
description: 'Git URL for self hosted version. Default value is api.github.com'
required: true
default: 'https://api.github.com'
portRunId:
description: 'Port run ID to came from triggering the action'
required: true
Expand Down
5 changes: 3 additions & 2 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ port_user_inputs="$INPUT_PORTUSERINPUTS"
monorepo_url="$INPUT_MONOREPOURL"
scaffold_directory="$INPUT_SCAFFOLDDIRECTORY"
branch_name="port_$port_run_id"
git_url="$INPUT_GITHUBURL"

get_access_token() {
curl -s --location --request POST 'https://api.getport.io/v1/auth/access_token' --header 'Content-Type: application/json' --data-raw "{
Expand Down Expand Up @@ -48,7 +49,7 @@ create_repository() {
-d "{ \
\"name\": \"$repository_name\", \"private\": true
}" \
https://api.github.com/orgs/$org_name/repos
$git_url/orgs/$org_name/repos
}

clone_monorepo() {
Expand Down Expand Up @@ -119,7 +120,7 @@ push_to_repository() {
-H "Authorization: token $github_token" \
-H "Content-Type: application/json" \
-d "$PR_PAYLOAD" \
"https://api.github.com/repos/$owner/$repo/pulls" | jq -r '.html_url')
"$git_url/repos/$owner/$repo/pulls" | jq -r '.html_url')

send_log "Opened a new PR in $pr_url 🚀"
add_link "$pr_url"
Expand Down

0 comments on commit c305b61

Please sign in to comment.