generalize day ahead prices #471
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
# SPDX-FileCopyrightText: 2017-2022 Contributors to the OpenSTEF project <[email protected]> # noqa E501 | |
# | |
# SPDX-License-Identifier: MPL-2.0 | |
# Copied from https://github.com/psf/black/actions/runs/17913292/workflow | |
# GitHub Action that uses Black to reformat the Python code in an incoming pull request. | |
# If all Python code in the pull request is compliant with Black then this Action | |
# does nothing. Otherwise, Black is run and its changes are committed to the | |
# incoming pull request. See https://github.com/cclauss/autoblack for a similar example. | |
name: Black Format Code | |
on: [pull_request] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: [3.9] | |
steps: | |
# Checkout | |
- name: Checkout | |
uses: actions/checkout@v1 | |
# Setup | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
# Install black | |
- name: Install Black | |
run: pip install black | |
# Run black --check | |
- name: Run black --check . | |
run: black --check . | |
# Run black (if needed) | |
- name: If needed, commit black changes to the pull request | |
if: failure() | |
run: | | |
black . | |
git config --global user.name 'black' | |
git config --global user.email '[email protected]' | |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | |
git fetch | |
git checkout $GITHUB_HEAD_REF | |
git commit --signoff -am "Format Python code with Black" | |
git push |