From 1148eead59eaad9a3216d914ca55e8a566456206 Mon Sep 17 00:00:00 2001 From: gokborayilmaz Date: Fri, 16 Aug 2024 18:03:13 +0300 Subject: [PATCH] feat: Added refactor process --- .github/workflows/refactor.yml | 28 ++++++++++++++++++++++++++++ refactor.py | 26 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 .github/workflows/refactor.yml create mode 100644 refactor.py diff --git a/.github/workflows/refactor.yml b/.github/workflows/refactor.yml new file mode 100644 index 0000000..0ffcb56 --- /dev/null +++ b/.github/workflows/refactor.yml @@ -0,0 +1,28 @@ + +name: Manual Refactor + +on: + workflow_dispatch: + +jobs: + run-refactor: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: setup git config + run: | + # setup the username and email. I tend to use 'GitHub Actions Bot' with no email by default + git config user.name "Upsonic Refactor Bot" + git config user.email "<>" + + - name: Run Refactor Script + run: | + python refactor.py diff --git a/refactor.py b/refactor.py new file mode 100644 index 0000000..6276cb3 --- /dev/null +++ b/refactor.py @@ -0,0 +1,26 @@ +import os + + +def install_refactor_tool(): + os.system("pip install ruff==0.6.0") + + +def refactor(): + os.system("ruff check --fix") + os.system("ruff format") + + +def create_commit(): + os.system("git add .") + os.system("git commit -m 'refactor: Scheduled refactoring'") + + +def push(): + os.system("git push") + + +if __name__ == "__main__": + install_refactor_tool() + refactor() + create_commit() + push() \ No newline at end of file