Manual API Data Update #34
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: Manual API Data Update | |
on: | |
workflow_dispatch: | |
jobs: | |
incentive-admin-data-update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Use Node.js 18.x | |
uses: actions/setup-node@v3 | |
with: | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
node-version: 18.x | |
cache: 'yarn' | |
- name: Install dependencies | |
run: yarn --frozen-lockfile | |
- name: Run transformation script | |
env: | |
INCENTIVE_ADMIN_HOST: 'https://incentive-admin.rewiringamerica.org/api/export' | |
run: | | |
npx ts-node scripts/incentive-admin-import.ts | |
- name: Check for changes | |
id: git_diff | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add data/ | |
if git diff --cached --quiet; then | |
echo "no changes" | |
echo "::set-output name=changes::false" | |
else | |
echo "changes detected" | |
echo "::set-output name=changes::true" | |
fi | |
- name: Create Pull Request | |
if: steps.git_diff.outputs.changes == 'true' | |
uses: peter-evans/create-pull-request@v6 | |
with: | |
commit-message: Incentive Admin Update | |
branch: incentive-admin-update | |
title: Incentive Admin Update | |
body: This PR updates the API data files, using data maintained by the [Incentive Admin](https://github.com/rewiringamerica/incentive_admin). | |
base: main |