-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hadar-co
authored
Oct 30, 2023
1 parent
1de708f
commit 4f41108
Showing
1 changed file
with
34 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,48 @@ | ||
name: Port action - create repository | ||
# portCreateRepo.yaml | ||
|
||
name: Scaffold a new service | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
name: | ||
type: string | ||
port_payload: | ||
required: true | ||
description: Port's payload, including details for who triggered the action and general context | ||
description: "Port's payload, including details for who triggered the action and general context (blueprint, run id, etc...)" | ||
type: string | ||
secrets: | ||
ORG_ADMIN_TOKEN: | ||
required: true | ||
PORT_CLIENT_ID: | ||
required: true | ||
PORT_CLIENT_SECRET: | ||
required: true | ||
jobs: | ||
create-repository: | ||
scaffold-service: | ||
env: | ||
ORG_NAME: <YOUR-ORG-NAME> | ||
runs-on: ubuntu-latest | ||
name: Create repository | ||
steps: | ||
- name: Create service | ||
uses: octobay/create-repository-action@v1 | ||
- uses: port-labs/cookiecutter-gha@v1 | ||
id: scaff | ||
with: | ||
name: ${{ inputs.name }} | ||
org: "Port-samples" # change this to the org name in which you want to create the new repo | ||
access-token: ${{ secrets.ORG_ADMIN_TOKEN }} # the secret we created in the previous step | ||
private-repo: true | ||
initialize-repo: true | ||
reflect-action-result: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create a log message # Send action progress/result back to Port | ||
portClientId: ${{ secrets.PORT_CLIENT_ID }} | ||
portClientSecret: ${{ secrets.PORT_CLIENT_SECRET }} | ||
token: ${{ secrets.ORG_ADMIN_TOKEN }} | ||
portRunId: ${{ fromJson(inputs.port_payload).context.runId }} | ||
repositoryName: ${{ fromJson(inputs.port_payload).payload.properties.service_name }} | ||
portUserInputs: '{"cookiecutter_app_name": "${{ fromJson(inputs.port_payload).payload.properties.service_name }}" }' | ||
cookiecutterTemplate: https://github.com/lacion/cookiecutter-golang | ||
blueprintIdentifier: "service" | ||
organizationName: ${{ env.ORG_NAME }} | ||
|
||
- name: "Report deployment Entity to port 🚢" | ||
uses: port-labs/port-github-action@v1 | ||
with: | ||
clientId: ${{ secrets.PORT_CLIENT_ID }} | ||
clientSecret: ${{ secrets.PORT_CLIENT_SECRET }} | ||
operation: PATCH_RUN | ||
runId: ${{fromJson(inputs.port_payload).context.runId}} | ||
logMessage: New service "${{ inputs.name }}" created successfully 🚀 | ||
identifier: ${{ fromJson(inputs.port_payload).payload.properties.service_name }} | ||
blueprint: service | ||
properties: | | ||
{ | ||
"url": "https://github.com/${{ env.ORG_NAME }}/${{ fromJson(inputs.port_payload).payload.properties.service_name }}", | ||
"language": "golang" | ||
} |