Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the repo to have 1 action #2

Merged
merged 57 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
2c84883
initial commit
yairsimantov20 Feb 19, 2024
16c1e96
initial commit
yairsimantov20 Feb 19, 2024
f3d4294
updated test file
yairsimantov20 Feb 20, 2024
6a6db59
Merge remote-tracking branch 'origin/create-ocean-github-action' into…
yairsimantov20 Feb 20, 2024
22287ab
updated test file
yairsimantov20 Feb 20, 2024
29711c5
updated test file
yairsimantov20 Feb 20, 2024
e6860b6
updated test file
yairsimantov20 Feb 20, 2024
2d79657
updated test file
yairsimantov20 Feb 20, 2024
a25e544
checking .env file
yairsimantov20 Feb 20, 2024
38ac09e
checking .env file
yairsimantov20 Feb 20, 2024
9f1fd5c
checking .env file
yairsimantov20 Feb 20, 2024
a8b40b2
checking .env file
yairsimantov20 Feb 20, 2024
8b42663
checking .env file
yairsimantov20 Feb 20, 2024
c6be02d
checking .env file
yairsimantov20 Feb 20, 2024
062fc1d
checking .env file
yairsimantov20 Feb 20, 2024
d9d7b40
checking .env file
yairsimantov20 Feb 20, 2024
a7e3440
checking .env file
yairsimantov20 Feb 20, 2024
5b0e039
checking .env file
yairsimantov20 Feb 20, 2024
8938790
checking .env file
yairsimantov20 Feb 20, 2024
6b28805
checking .env file
yairsimantov20 Feb 20, 2024
7c8e8f1
checking .env file
yairsimantov20 Feb 20, 2024
6c00c39
checking .env file
yairsimantov20 Feb 20, 2024
5fecbf3
checking .env file
yairsimantov20 Feb 20, 2024
33137dd
checking .env file
yairsimantov20 Feb 20, 2024
69fccd4
checking .env file
yairsimantov20 Feb 20, 2024
de753d2
checking .env file
yairsimantov20 Feb 20, 2024
bdafacc
checking .env file
yairsimantov20 Feb 20, 2024
fab1c18
checking .env file
yairsimantov20 Feb 20, 2024
41d9acc
checking .env file
yairsimantov20 Feb 20, 2024
15fe8fb
checking .env file
yairsimantov20 Feb 20, 2024
085a8da
checking .env file
yairsimantov20 Feb 20, 2024
54b3810
checking .env file
yairsimantov20 Feb 20, 2024
44d8edf
checking .env file
yairsimantov20 Feb 20, 2024
e9d4e67
checking .env file
yairsimantov20 Feb 20, 2024
b760aca
checking .env file
yairsimantov20 Feb 20, 2024
bc3170e
added secrets
yairsimantov20 Feb 20, 2024
2b4922d
added secrets
yairsimantov20 Feb 20, 2024
56bfa59
readme
yairsimantov20 Feb 20, 2024
55fadb9
readme
yairsimantov20 Feb 20, 2024
f13a04f
readme
yairsimantov20 Feb 20, 2024
3f85388
Update .github/workflows/test.yml
yairsimantov20 Feb 20, 2024
632b312
naming
yairsimantov20 Feb 20, 2024
6491cc9
Update README.md
yairsimantov20 Feb 20, 2024
4461abd
Update sail/README.md
yairsimantov20 Feb 20, 2024
1628252
Update sail/action.yml
yairsimantov20 Feb 20, 2024
e9ef5d3
cr
yairsimantov20 Feb 20, 2024
16ee040
Merge remote-tracking branch 'origin/create-ocean-github-action' into…
yairsimantov20 Feb 20, 2024
9e69a38
cr
yairsimantov20 Feb 20, 2024
7d2aadc
cr
yairsimantov20 Feb 20, 2024
e97a47e
cr
yairsimantov20 Feb 20, 2024
354b1e6
whitespace
yairsimantov20 Feb 20, 2024
64d7fa9
updated the action to have 1 action in the repo
yairsimantov20 Feb 21, 2024
6790f5c
updated the readme
yairsimantov20 Feb 21, 2024
4eaed38
Merge remote-tracking branch 'origin/main' into create-ocean-github-a…
yairsimantov20 Feb 21, 2024
22f60b8
changed .env file name
yairsimantov20 Feb 21, 2024
935bf19
removed sail folder
yairsimantov20 Feb 21, 2024
fd4c945
updated pr
yairsimantov20 Feb 21, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: ./
- name: Checkout
uses: actions/checkout@v4

- uses: .
with:
# input params if you have any
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.JIRA_USER_EMAIL }}
atlassian_user_token: ${{ secrets.JIRA_USER_TOKEN }}
96 changes: 96 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
__tests__/runner/*

node_modules/
lib/

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
jspm_packages/

# TypeScript v1 declaration files
typings/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test

# parcel-bundler cache (https://parceljs.org/)
.cache

# next.js build output
.next

# nuxt.js build output
.nuxt

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# Text editor files
.vscode/
3 changes: 2 additions & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down Expand Up @@ -198,4 +199,4 @@
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.
62 changes: 61 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
# ocean-github-action
<!-- 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 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)

<!-- action-docs-description action="action.yml" -->
## Description

Runs the Ocean Sail command for a specific type of integration
<!-- action-docs-description action="action.yml" -->

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

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: ocean-github-action/sail@v1
yairsimantov20 marked this conversation as resolved.
Show resolved Hide resolved
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 }}
```
5 changes: 5 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Releases

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

89 changes: 89 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: '🌊 Ocean Sail'
description: 'Runs the Ocean Sail command for a specific type of integration'
inputs:
type:
description: 'The type of the integration to run'
required: true
identifier:
description: 'The identifier of the integration to run'
required: false
port_client_id:
description: 'The Port client id'
required: true
port_client_secret:
description: 'The Port client secret'
required: true
initialize_port_resources:
description: 'Should Ocean try to create the default resources (blueprints, pages, integration config, etc.) provided with the integration'
required: false
default: 'true'
config:
description: 'The configuration for the integration'
required: false

# Misc inputs
platform:
description: 'The platform to run the integration on'
required: false
default: 'linux/amd64'
image:
description: 'The image to run the integration from'
required: false
version:
description: 'The version of the integration to run'
required: false
default: 'latest'
outputs:
exit_code:
description: 'The exit code of the Ocean Sail command'
value: ${{ steps.ocean-sail.outputs.exit_code }}
runs:
using: "composite"
steps:
- name: ✅ Validate inputs
shell: bash
run: |
[[ "${{ inputs.type }}" ]] || { echo "type input is empty" ; exit 1; }
[[ "${{ inputs.port_client_id }}" ]] || { echo "inputs.port_client_id input is empty" ; exit 1; }
[[ "${{ inputs.port_client_secret }}" ]] || { echo "inputs.port_client_secret input is empty" ; exit 1; }
[[ "${{ inputs.initialize_port_resources }}" ]] || { echo "inputs.initialize_port_resources input is empty" ; exit 1; }
[[ "${{ inputs.event_listener_type }}" ]] || { echo "inputs.event_listener_type input is empty" ; exit 1; }
[[ "${{ inputs.platform }}" ]] || { echo "inputs.platform input is empty" ; exit 1; }
[[ "${{ inputs.version }}" ]] || { echo "inputs.version input is empty" ; exit 1; }

- name: 🌊 Run Ocean Sail dockerized
shell: bash
run: |
image_name="ghcr.io/port-labs/port-ocean-${{ inputs.type }}:${{ inputs.version }}"
if [[ "${{ inputs.image }}" ]]; then
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__EVENT_LISTENER={\"type\":\"ONCE\"}" >> .env
echo "OCEAN__INITIALIZE_PORT_RESOURCES=${{ inputs.initialize_port_resources }}" >> .env

if [[ "${{ inputs.identifier }}" ]]; then
echo "OCEAN__INTEGRATION__IDENTIFIER=${{ inputs.identifier }}" >> .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
done
fi

env >> .env

docker run -i --rm --platform=${{ inputs.platform }} --env-file .env $image_name

echo "exit_code=$?" >> $GITHUB_ENV

- name: 🧹 Cleanup
if: always()
shell: bash
run: rm .env
Loading