Skip to content

feat: expose typeorm config object #32

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

Merged
merged 4 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 17 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Check out our [example repositories](https://github.com/githubocto?q=flat-demo&t

### Option 1: Flat Editor VSCode Extension

The easiest way to get a Flat Data action up and running is with the accompanying [Flat Editor VSCode Extension](https://marketplace.visualstudio.com/items?itemName=GitHubOCTO.flat) which helps you author Flat yml files.
The easiest way to get a Flat Data action up and running is with the accompanying [Flat Editor VSCode Extension](https://marketplace.visualstudio.com/items?itemName=GitHubOCTO.flat) which helps you author Flat yml files.

To use it, [install the extension](https://marketplace.visualstudio.com/items?itemName=GitHubOCTO.flat) and then invoke `Flat Editor` from the command palette within VSCode (Mac: ⌘⇧P, Others:ctrl-shift-P).

Expand Down Expand Up @@ -85,13 +85,13 @@ These two modes are exclusive; you cannot mix settings for these two in one Flat

#### `http_url`

A URL from which to fetch data. Specifying this input puts Flat into `http` mode.
A URL from which to fetch data. Specifying this input puts Flat into `http` mode.

This can be any endpoint: a json, csv, png, zip, xlsx, etc.

#### `downloaded_filename`

The name of the file to store data fetched by Flat.
The name of the file to store data fetched by Flat.

In `http` mode this can be anything. This can be any endpoint: a json, csv, txt, png, zip, xlsx, etc. file

Expand All @@ -111,7 +111,6 @@ If your `http_url` string contains secrets, you can choose to mask it from the c

`mask: '["${{ secrets.SECRET1 }}", "${{ secrets.SECRET2 }}"]'`


### SQL Mode

#### `sql_connstring`
Expand All @@ -128,19 +127,30 @@ A URI-style database connection string. Flat will use this connection string to
>
> If you're using the [flat-vscode extension](https://github.com/githubocto/flat-vscode), this is handled for you.


#### `sql_queryfile`

The pathname of the file containing the SQL query that will be issued to the database. Defaults to `.github/workflows/query.sql`. This path is relative to the root of your repo.

#### `downloaded_filename`

The name of the file to store data fetched by Flat.
The name of the file to store data fetched by Flat.

In `sql` mode this should be one of `csv` or `json`. SQL query results will be serialized to disk in the specified format.

> ⚠️ While the JSON is not pretty-printed, CSV is often a more efficient serialization for tabular data.

#### `typeorm_config` (optional)

A JSON string representing a configuration passed to [TypeORMs createConnection function](https://orkhan.gitbook.io/typeorm/docs/connection-api#main-api).

A common use case for this value is connecting your [Flat action to a Heroku database](https://github.com/typeorm/typeorm/issues/278).

For instance, you can pass the following configuration string to your Flat action in order to connect to a Heroku Postgres database.

```yaml
typeorm_config: '{"ssl":true,"extra":{"ssl":{"rejectUnauthorized":false}}}'
```

#### `postprocess` (optional)

A path to a local Deno javascript or typescript file for postprocessing the `downloaded_filename` file. Read more in the ["Postprocessing section"](https://github.com/githubocto/flat#postprocessing).
Expand All @@ -155,7 +165,7 @@ A signed number describing the number of bytes that changed in this run. If the

You can add a `postprocess` input in the Action which is path to a [deno](https://deno.land) Javascript or Typescript script that will be invoked to postprocess your data after it is fetched. This path is relative to the root of your repo.

The script can use either `Deno.args[0]` or the name of the `downloaded_filename` to access the file fetched by Flat Data.
The script can use either `Deno.args[0]` or the name of the `downloaded_filename` to access the file fetched by Flat Data.

```ts
import { readJSON, writeJSON } from 'https://deno.land/x/flat/mod.ts'
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ inputs:
description: 'A path (relative to the root of your repo) of a SQL query file to execute for fetching data.'
required: false
default: '.github/workflows/query.sql'
typeorm_config:
description: 'A JSON string representing a configuration passed to TypeORMs createConnection function'
required: false
postprocess:
description: 'A path (relative to the root of your repo) or a URL to a deno postprocessing script.'
required: false
Expand Down
16 changes: 4 additions & 12 deletions dist/LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,6 @@ MIT

@actions/io
MIT
The MIT License (MIT)

Copyright 2019 GitHub

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

@azure/ms-rest-azure-env
MIT
Expand Down Expand Up @@ -3100,7 +3091,7 @@ pg
MIT
MIT License

Copyright (c) 2010 - 2021 Brian Carlson
Copyright (c) 2010 - 2020 Brian Carlson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -3191,7 +3182,7 @@ pg-protocol
MIT
MIT License

Copyright (c) 2010 - 2021 Brian Carlson
Copyright (c) 2010 - 2020 Brian Carlson

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down Expand Up @@ -4208,7 +4199,8 @@ MIT

underscore
MIT
Copyright (c) 2009-2021 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors
Copyright (c) 2009-2020 Jeremy Ashkenas, DocumentCloud and Investigative
Reporters & Editors

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
Loading