From 18b63cf03f52875cd2e916bbf32f70cbce196770 Mon Sep 17 00:00:00 2001 From: Anthony Volk Date: Tue, 5 Aug 2025 15:55:09 -0300 Subject: [PATCH] fix: Update script to open automated API update PRs --- .github/update_api.py | 9 +++++---- changelog_entry.yaml | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/update_api.py b/.github/update_api.py index fc885b088..b6128b35a 100644 --- a/.github/update_api.py +++ b/.github/update_api.py @@ -1,12 +1,13 @@ import argparse +import tomllib import os def main(): # First, find the current package version number from the setup.py file - with open("pyproject.toml", "r") as f: - setup = f.read() - version = setup.split("version = ")[1].split(",")[0].strip('"') + with open("pyproject.toml", "rb") as f: + data = tomllib.load(f) + version = data["project"]["version"] # Then, clone the https://github.com/policyengine/policyengine-api repo using the GitHub CLI pat = os.environ["GITHUB_TOKEN"] os.system( @@ -18,7 +19,7 @@ def main(): ) # Repeat the above for https://github.com/policyengine/policyengine-household-api os.system( - f"git clone https://nikhilwodruff:{pat}@github.com/policyengine/policyengine-household-api" + f"git clone https://nikhilwoodruff:{pat}@github.com/policyengine/policyengine-household-api" ) # Then, cd inside and run gcp/bump_country_package.py --country policyengine-uk --version {version} diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb..4487c5fa1 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,4 @@ +- bump: patch + changes: + changed: + - Updated script to open automated API update PRs \ No newline at end of file