From f2ed56d159e93451934491d84150ac2ed61a0510 Mon Sep 17 00:00:00 2001 From: John Vouvakis Manousakis Date: Fri, 21 Jun 2024 18:34:36 -0700 Subject: [PATCH] Test 2 --- .github/workflows/format_and_lint.yaml | 65 +++++++++----------------- pelicun/file_io.py | 3 ++ 2 files changed, 25 insertions(+), 43 deletions(-) diff --git a/.github/workflows/format_and_lint.yaml b/.github/workflows/format_and_lint.yaml index 7c1afc43a..d731c6771 100644 --- a/.github/workflows/format_and_lint.yaml +++ b/.github/workflows/format_and_lint.yaml @@ -1,50 +1,29 @@ -name: Code Formatting and Linting - +name: Push commit on: push: pull_request: - +permissions: + contents: write jobs: format_and_lint: runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.x' - - - name: Install Black and Flake8 - run: | - python -m pip install --upgrade pip - pip install black flake8 - - - name: Run Black - run: black -S . - - - name: Check for changes - id: git_status - run: | - git config --global user.name 'github-actions[bot]' - git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' - git add . - if git diff-index --quiet HEAD --; then - echo "No changes to commit" > /tmp/git_status_output - else - git commit -m "Format code with Black" - echo "Changes committed" > /tmp/git_status_output - fi - continue-on-error: true - - - name: Read git status output - id: read_git_status - run: cat /tmp/git_status_output - - - name: Push changes - if: steps.read_git_status.outputs.result != 'No changes to commit' - uses: ad-m/github-push-action@v0.6.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} + - name: Checkout code + uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.x' + - name: Install Black and Flake8 + run: | + python -m pip install --upgrade pip + pip install black flake8 + - name: Run Black + run: black -S . + - name: Commit changes + run: | + git config --global user.name 'GitHubBot' + git config --global user.email 'GitHubBot@users.noreply.github.com' + git add -u + git commit -am "Format code with black" + git push diff --git a/pelicun/file_io.py b/pelicun/file_io.py index 403e70298..ccc6ba4ec 100644 --- a/pelicun/file_io.py +++ b/pelicun/file_io.py @@ -509,6 +509,9 @@ def load_from_file(filepath: str, log: base.Logger | None = None) -> pd.DataFram encoding_errors='replace', ) + + + if log: log.msg('File successfully opened.', prepend_timestamp=False)