Skip to content

Commit

Permalink
ci: use pr instead of commit to generate powerplants.csv (#188)
Browse files Browse the repository at this point in the history
* docs: add body message to release note

* ci: use pr instead of commit to generate `powerplants.csv`
  • Loading branch information
lkstrp authored Jul 31, 2024
1 parent 144a187 commit e7dfd07
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
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
]

0 comments on commit e7dfd07

Please sign in to comment.