Last active
August 23, 2022 09:42
-
-
Save ngshiheng/7c4bdfe444c1f8a1fb27500b649fee38 to your computer and use it in GitHub Desktop.
I Export PostgreSQL Queries to Google Sheets For Free. Here’s How https://jerrynsh.com/i-export-postgresql-queries-to-gsheets-for-free-heres-how/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate CSV | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "30 23 * * *" # https://crontab.guru/#30_23_*_*_* | |
env: | |
PGDATABASE: ${{ secrets.PGDATABASE }} | |
PGHOST: ${{ secrets.PGHOST }} | |
PGPASSWORD: ${{ secrets.PGPASSWORD }} | |
PGPORT: ${{ secrets.PGPORT }} | |
PGUSER: ${{ secrets.PGUSER }} | |
jobs: | |
generate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install PostgreSQL | |
run: | | |
sudo apt-get update | |
sudo apt-get install --yes postgresql | |
- name: Generate CSV | |
run: scripts/generate_csv.sh | |
shell: bash | |
- name: Get current date | |
id: date | |
run: echo "::set-output name=date::$(TZ=Asia/Singapore date +'%d %b %Y')" | |
- name: Commit changes | |
if: ${{ success() }} | |
uses: EndBug/add-and-commit@v9 | |
with: | |
pull: "--rebase --autostash ." | |
message: "chore(data): update generated csv automatically for ${{ steps.date.outputs.date }} data" | |
default_author: github_actions |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment