https://github.com/yakubique/query-postgresql
Make query to PostgreSQL and return JSON
https://github.com/yakubique/query-postgresql
github-actions pg postgresql
Last synced: 2 months ago
JSON representation
Make query to PostgreSQL and return JSON
- Host: GitHub
- URL: https://github.com/yakubique/query-postgresql
- Owner: yakubique
- License: mit
- Created: 2024-02-11T07:29:52.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-27T12:31:38.000Z (over 2 years ago)
- Last Synced: 2025-01-25T14:25:29.583Z (over 1 year ago)
- Topics: github-actions, pg, postgresql
- Language: TypeScript
- Homepage:
- Size: 185 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# query-postgresql
Make query to PostgreSQL and return JSON
[](https://github.com/yakubique/query-postgresql/actions/workflows/test-myself.yaml)
## Usage
For live examples, please see [actions](https://github.com/yakubique/query-postgresql/actions/workflows/test-myself.yaml)
```yaml
uses: yakubique/query-postgresql@v1.2
with:
query: |
select true as result
host: ${{ env.PG_HOST }}
port: ${{ env.PG_PORT }}
username: ${{ env.PG_USER }}
password: ${{ env.PG_PWD }}
db: ${{ env.PG_DB }}
ssl: 'false'
```
## Inputs
| INPUT | TYPE | REQUIRED | DEFAULT | DESCRIPTION |
|-----------|--------|----------|----------|--------------------------------------------|
| db | string | true | | PostgreSQL db |
| host | string | true | | PostgreSQL host |
| username | string | true | | PostgreSQL username |
| password | string | true | | PostgreSQL password |
| port | string | true | `"5432"` | PostgreSQL port (default: 5432) |
| query | string | true | | SQL query (query file if `from_file=true`) |
| ssl | string | false | `"true"` | SSL enabled (default: 'true') |
| from_file | string | false | | Read query from file (default: 'false') |
| to_file | string | false | | Save result to file (default: 'false') |
## Outputs
| OUTPUT | TYPE | DESCRIPTION |
|--------|--------|-------------------------------------|
| count | string | Rows count |
| result | string | PostgreSQL response OR path to file |
----
[](https://ko-fi.com/S6S1UZ9P7)