Skip to content

Generate CSV and Excel formats from JSON #16

Generate CSV and Excel formats from JSON

Generate CSV and Excel formats from JSON #16

name: Generate CSV and Excel formats from JSON
on:
push:
paths:
- 'yemen-info.json'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions: write-all
strategy:
fail-fast: true
steps:
- uses: actions/checkout@v3
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
- name: Install dependencies
working-directory: "./utilities/json2csv"
run: composer install --no-interaction
- name: List Installed Dependencies
working-directory: "./utilities/json2csv"
run: composer show -D
- name: Execute command
run: cd utilities/json2csv && php json2csv convert
- name: Set file permissions
run: chmod 777 automated/yemen-info.csv automated/yemen-info.xlsx
- name: Add and commit generated file
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add .
git commit -m "automatically converted csv and excel after editing yemen-info.json"
- name: Push the generated file
uses: ad-m/[email protected]
with:
github_token: ${{ secrets.GIT_ACTION_TOKEN }}
branch: main