Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
sivashanmukh authored May 27, 2021
1 parent 308550f commit c43f0ba
Showing 1 changed file with 73 additions and 71 deletions.
144 changes: 73 additions & 71 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,88 +10,90 @@ uses: rudderlabs/rudder-transformation-action@<version>
with:
metaPath: './code/meta.json'
email: '[email protected]'
accessToken: ${{ secrets.ACCESS_KEY }}
serverEndpoint: 'https://api.rudderlabs.com'
accessToken: ${{ secrets.ACCESS_TOKEN }}
uploadTestArtifact: true
```
> Note: The action does the work of testing a transformation for a given set of events, it's creation and updation along with any custom libraries using the transformation API. To read more about check [here](https://rudderstack.com/blog/rudderstacks-transformations-api). For the action to work, one would need the workspace email and accessToken. Learn how to generate accessToken [here](https://docs.rudderstack.com/adding-a-new-user-transformation-in-rudderstack/rudderstack-transformation-api/api-access-token)
> Note: The action does the work of testing a transformation for a given set of events, it's creation and updation along with any custom libraries using the [transformation API](https://docs.rudderstack.com/adding-a-new-user-transformation-in-rudderstack/rudderstack-transformation-api). Read more in [this blog post](https://rudderstack.com/blog/rudderstacks-transformations-api).
For examples of using the action, checkout this [sample repository](https://github.com/rudderlabs/rudder-transformation-action-code/tree/main/.github/workflows)
> For the action to work, one would need the workspace email and accessToken. Learn how to generate accessToken [here](https://docs.rudderstack.com/adding-a-new-user-transformation-in-rudderstack/rudderstack-transformation-api/api-access-token)
## Action Spec
### Inputs
- `metaPath` (required) : The path to the meta file, the meta file let's the action know what transformations and libraries to test based on set of input events and the expected output, as well publish these transformations and libraries if the test passes.

**Meta file structure**
> For examples of using the action, checkout this [sample repository](https://github.com/rudderlabs/rudder-transformation-action-code/tree/main/.github/workflows)
```jsx
// Meta file schema
{
"transformations" : <array of transformationSchema>,
"libraries" : <array of librarySchema>
> We recommend using git secrets to store your accessToken for security purposes and use it as mentioned in the above example
}
```

```jsx
// single transformationSchema
{
"file" (required): <path to the transformation code>,
"name" (required): <transformation name>,
"description" (optional): <transformation description>,
"test-input-file" (optional) : <path to file containing an array of events to test the transformation>,
"expected-output" (optional) : <path to file containing an array of expected output for the above input after running the transformation code>
}
```

```jsx
// single librarySchema
{
"file" (required): <path to the library code>,
"name" (required): <library name: this is the name by which to import it in any transformation code>,
"description" (optional): <library description> ,
}
```

```jsx
// example meta.json
{
"transformations": [
{
"file": "./code/t1.js",
"name": "action-T1",
"description": "action-T1",
"test-input-file": "./code/events.json",
"expected-output": "./code/expected.json"
},
{
"file": "./code/t2.js",
"name": "action-T2",
"description": "action-T2"
}
],
"libraries": [
{
"file": "./code/lib1.js",
"name": "lib1",
"description": "action-lib1"
},
{
"file": "./code/lib2.js",
"name": "lib2",
"description": "action-lib2"
}
]
}
```
## Action Spec
> Note: All paths to files above should be relative to the base repo path
### Inputs
- `email` (required) : RudderStack app workspace email.
- `accessToken` (required) : RudderStack app corresponding accessToken.
- `uploadTestArtifact` (optional) : boolean flag on whether to upload the individual transformation outputs after running the transformation on the test events and it's diff from expected output for each.
- When test-input-file is provided, actual outputs of all transformations with respective inputs from test-input-file are dumped into artifacts
- When expected-output is provided, the above outputs are validated against the contents in expected-output and a diff is returned in artifacts if there is any.
- `metaPath` (required) : The path to the meta file, the meta file let's the action know what transformations and libraries to test based on set of input events and the expected output, as well publish these transformations and libraries if the test passes.

Meta file structure

```jsx
// Meta file schema
{
"transformations" : <array of transformationSchema>,
"libraries" : <array of librarySchema>
}
```

```jsx
// single transformationSchema
{
"file" (required): <path to the transformation code>,
"name" (required): <transformation name>,
"description" (optional): <transformation description>,
"test-input-file" (optional) : <path to file containing an array of events to test the transformation>,
"expected-output" (optional) : <path to file containing an array of expected output for the above input after running the transformation code>
}
```

```jsx
// single librarySchema
{
"file" (required): <path to the library code>,
"name" (required): <library name: this is the name by which to import it in any transformation code>,
"description" (optional): <library description> ,
}
```

```jsx
// example meta.json
{
"transformations": [
{
"file": "./code/t1.js",
"name": "action-T1",
"description": "action-T1",
"test-input-file": "./code/events.json",
"expected-output": "./code/expected.json"
},
{
"file": "./code/t2.js",
"name": "action-T2",
"description": "action-T2"
}
],
"libraries": [
{
"file": "./code/lib1.js",
"name": "lib1",
"description": "action-lib1"
},
{
"file": "./code/lib2.js",
"name": "lib2",
"description": "action-lib2"
}
]
}
```

> Note: All paths to files above should be relative to the base repo path

0 comments on commit c43f0ba

Please sign in to comment.