Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: use pr instead of commit to generate powerplants.csv #188

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 18 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ jobs:
- uses: actions/checkout@v4
- uses: softprops/action-gh-release@v2
with:
body: |
Revised release notes are available in the [documentation](https://powerplantmatching.readthedocs.io/en/latest/release-notes.html).
append_body: true
generate_release_notes: true

publish:
Expand All @@ -44,40 +47,35 @@ jobs:

update-dataset:
name: Update powerplants.csv in repository
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: master

- name: Fetch all history for all tags and branches (necessary for setuptools_scm)
run: git fetch --prune --unshallow
fetch-depth: 0 # Needed for setuptools_scm

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.9
python-version: 3.12

- name: Install package
run: |
python -m pip install --upgrade pip
pip install .[dev]

python -m pip install uv
uv pip install --system "$(ls dist/*.whl)[dev]"
- name: Create dataset
run: |
import powerplantmatching as pm
df = pm.powerplants(update=True)
df.to_csv("powerplants.csv", index_label="id")
shell: python

- name: Commit and push changes
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
git checkout master
git pull origin master
git add powerplants.csv
git commit -m '[github-actions.ci] auto update `powerplants.csv`' || exit 0
git push origin master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
commit-message: '[github-actions.ci] auto update `powerplants.csv`'
title: 'Update `powerplants.csv`'
body: 'This PR updates the `powerplants.csv` dataset after a new release.'
branch: 'auto-update-powerplants-csv'
base: 'master'
13 changes: 7 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ version_scheme = "post-release"
[tool.setuptools.packages.find]
include = ["powerplantmatching"]

# Pytest settings

[tool.pytest.ini_options]
filterwarnings = [
"error::FutureWarning", # Raise all FutureWarnings as errors
]

# Formatter and linter settings

[tool.ruff]
Expand All @@ -85,9 +92,3 @@ select = [
'NPY', # numpy
]

# Pytest settings

[tool.pytest.ini_options]
filterwarnings = [
"error::FutureWarning", # Raise all FutureWarnings as errors
]