Skip to content

Commit

Permalink
Updated the repo to have 1 action (#2)
Browse files Browse the repository at this point in the history
Co-authored-by: MatanHeledPort <[email protected]>
Co-authored-by: Mor Paz <[email protected]>
  • Loading branch information
3 people authored Feb 21, 2024
1 parent 2925f7f commit 5f902ea
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 85 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- uses: ./sail
- uses: .
with:
type: 'jira'
port_client_id: ${{ secrets.PORT_CLIENT_ID }}
Expand Down
61 changes: 52 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,61 @@
<!-- action-docs-header action="action.yml" -->

<!-- action-docs-header action="action.yml" -->

<img align="right" width="100" height="74" src="https://user-images.githubusercontent.com/8277210/183290025-d7b24277-dfb4-4ce1-bece-7fe0ecd5efd4.svg" />

# Ocean GitHub Action - by getPort.io
# Ocean Sail GitHub Action - by getPort.io

[![Slack](https://img.shields.io/badge/Slack-4A154B?style=for-the-badge&logo=slack&logoColor=white)](https://www.getport.io/community)

Read more about the Ocean framework [here](https://ocean.getport.io/)
<!-- action-docs-description action="action.yml" -->
## Description

All the possible Ocean integrations can be found at the [Ocean integrations library](https://ocean.getport.io/integrations-library/)
Runs the Ocean Sail command for a specific type of integration
<!-- action-docs-description action="action.yml" -->

# Actions
The `sail` command is part of the Ocean framework and is used to run integrations.

This repository contains GitHub Actions for use with the Ocean framework.

| Action | Description |
|--------------------------|----------------------------------------------------------------|
| [sail](./sail/README.md) | Runs the Ocean Sail command for a specific type of integration |
Read more about the Ocean framework [here](https://ocean.getport.io/)

<!-- action-docs-inputs action="action.yml" -->
## Inputs

| name | description | required | default |
| --- | --- | --- | --- |
| `type` | <p>The type of the integration to run</p> | `true` | `""` |
| `identifier` | <p>The identifier of the integration to run</p> | `false` | `""` |
| `port_client_id` | <p>The Port client id</p> | `true` | `""` |
| `port_client_secret` | <p>The Port client secret</p> | `true` | `""` |
| `initialize_port_resources` | <p>Should ocean try to create the default blueprints, pages &amp; integration config for the integration</p> | `false` | `true` |
| `config` | <p>The configuration for the integration</p> | `false` | `""` |
| `platform` | <p>The platform to run the integration on</p> | `false` | `linux/amd64` |
| `image` | <p>The image to run the integration from</p> | `false` | `""` |
| `version` | <p>The version of the integration to run</p> | `false` | `latest` |
<!-- action-docs-inputs action="action.yml" -->

<!-- action-docs-outputs action="action.yml" -->
## Outputs

| name | description |
| --- | --- |
| `exit_code` | <p>The exit code of the Ocean Sail command</p> |
<!-- action-docs-outputs action="action.yml" -->

## Available integration types

All available integration types are listed in the [Ocean integrations library](https://ocean.getport.io/integrations-library/) and can also be found in the data sources menu in the Port UI.

## Example usage

```yaml
- uses: port-labs/ocean-sail@v1
with:
type: 'jira'
port_client_id: ${{ secrets.PORT_CLIENT_ID }}
port_client_secret: ${{ secrets.PORT_CLIENT_SECRET }}
config: |
jira_host: ${{ secrets.JIRA_HOST }}
atlassian_user_email: ${{ secrets.ATLASSIAN_USER_EMAIL }}
atlassian_user_token: ${{ secrets.ATLASSIAN_USER_TOKEN }}
```
2 changes: 1 addition & 1 deletion RELEASES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Releases

### 1.0.0
- Initial release
- Initial release of the ocean sail action

18 changes: 9 additions & 9 deletions sail/action.yml → action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,31 +59,31 @@ runs:
image_name="${{ inputs.image }}:${{ inputs.version }}"
fi
echo "OCEAN__PORT__CLIENT_ID=${{ inputs.port_client_id }}" >> .env
echo "OCEAN__PORT__CLIENT_SECRET=${{ inputs.port_client_secret }}" >> .env
echo "OCEAN__PORT__CLIENT_ID=${{ inputs.port_client_id }}" >> .sail-env
echo "OCEAN__PORT__CLIENT_SECRET=${{ inputs.port_client_secret }}" >> .sail-env
echo "OCEAN__EVENT_LISTENER={\"type\":\"ONCE\"}" >> .env
echo "OCEAN__INITIALIZE_PORT_RESOURCES=${{ inputs.initialize_port_resources }}" >> .env
echo "OCEAN__EVENT_LISTENER={\"type\":\"ONCE\"}" >> .sail-env
echo "OCEAN__INITIALIZE_PORT_RESOURCES=${{ inputs.initialize_port_resources }}" >> .sail-env
if [[ "${{ inputs.identifier }}" ]]; then
echo "OCEAN__INTEGRATION__IDENTIFIER=${{ inputs.identifier }}" >> .env
echo "OCEAN__INTEGRATION__IDENTIFIER=${{ inputs.identifier }}" >> .sail-env
fi
if [[ "${{ inputs.config }}" ]]; then
for key in $(echo "${{ inputs.config }}" | yq eval "keys | .[]"); do
value=$(echo "${{ inputs.config }}" | yq eval ".$key")
upper_key=$(echo $key | tr '[:lower:]' '[:upper:]')
echo "OCEAN__INTEGRATION__CONFIG__${upper_key}=${value}" >> .env
echo "OCEAN__INTEGRATION__CONFIG__${upper_key}=${value}" >> .sail-env
done
fi
env >> .env
env >> .sail-env
docker run -i --rm --platform=${{ inputs.platform }} --env-file .env $image_name
docker run -i --rm --platform=${{ inputs.platform }} --env-file .sail-env $image_name
echo "exit_code=$?" >> $GITHUB_ENV
- name: 🧹 Cleanup
if: always()
shell: bash
run: rm .env
run: rm .sail-env
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"name": "ocean-github-action",
"version": "1.0.0",
"repository": "[email protected]:port-labs/ocean-github-action.git",
"repository": "[email protected]:port-labs/ocean-sail.git",
"author": "yair <[email protected]>",
"license": "Apache-2.0",
"dependencies": {
"action-docs": "^2.1.0"
},
"scripts": {
"ghadocs": "action-docs -u"
}
}
55 changes: 0 additions & 55 deletions sail/README.md

This file was deleted.

9 changes: 0 additions & 9 deletions sail/package.json

This file was deleted.

0 comments on commit 5f902ea

Please sign in to comment.