combine converting to one github action #25
This file contains 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 needed 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 | ||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
- name: install required libraries | ||
run: pip install -r requirements.txt | ||
- name: run the tests | ||
run: python3 -B -m pytest tests/ | ||
- name: run the automated tasks | ||
run: python3 -B utilities/automated-tasks.py | ||
- 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 pull origin main | ||
git config --local user.email "action@github.com" | ||
git config --local user.name "GitHub Actions" | ||
git add . | ||
git commit -m "automatically converted after editing yemen-info.json" | ||
- name: push the generated file | ||
uses: ad-m/github-push-action@v0.6.0 | ||
with: | ||
github_token: ${{ secrets.GIT_ACTION_TOKEN }} | ||
branch: main |