From 23db05207d49dd980a00a2bc95fe262b80cea28c Mon Sep 17 00:00:00 2001 From: maximilien_notz Date: Sat, 26 Apr 2025 17:59:35 +0100 Subject: [PATCH 1/2] first commit --- .github/workflows/PR-review-bot.yml | 40 +++++++++++++++++++++++++++++ requirements.txt | 2 ++ 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/PR-review-bot.yml create mode 100644 requirements.txt diff --git a/.github/workflows/PR-review-bot.yml b/.github/workflows/PR-review-bot.yml new file mode 100644 index 0000000..9e7df17 --- /dev/null +++ b/.github/workflows/PR-review-bot.yml @@ -0,0 +1,40 @@ +name: Pull Request Review Bot + +on: + pull_request: + branch: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Download Repo In Docker + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' # fallback if .python-version is missing + + - name: Install dependencies + run: | + pip install -r requirements.txt + pip install pytest + + - name: Run tests and save output + id: test + run: | + pytest | tee result.loge + + - name: Request changes if tests failed + if: failure() # Only runs if the test step fails + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.GH_BOT_PAT }}" \ + -H "Accept: application/vnd.github.v3+json" \ + https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \ + -d '{ + "body": "🚨 Your pull request failed the tests. Please fix them before we can merge.", + "event": "REQUEST_CHANGES" + }' diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..31ef97d --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +numpy +pytest \ No newline at end of file From 27ac945e357139bde466747816596cbf393e536a Mon Sep 17 00:00:00 2001 From: maximilien_notz Date: Sun, 27 Apr 2025 12:35:10 +0100 Subject: [PATCH 2/2] update code tester --- .github/workflows/PR-review-bot.yml | 40 ----------------------------- .github/workflows/code-tester.yml | 25 ++++++++++++++++++ 2 files changed, 25 insertions(+), 40 deletions(-) delete mode 100644 .github/workflows/PR-review-bot.yml create mode 100644 .github/workflows/code-tester.yml diff --git a/.github/workflows/PR-review-bot.yml b/.github/workflows/PR-review-bot.yml deleted file mode 100644 index 9e7df17..0000000 --- a/.github/workflows/PR-review-bot.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Pull Request Review Bot - -on: - pull_request: - branch: [ master ] - -jobs: - test: - runs-on: ubuntu-latest - - steps: - - name: Download Repo In Docker - uses: actions/checkout@v3 - - - name: Set up Python - uses: actions/setup-python@v4 - with: - python-version: '3.10' # fallback if .python-version is missing - - - name: Install dependencies - run: | - pip install -r requirements.txt - pip install pytest - - - name: Run tests and save output - id: test - run: | - pytest | tee result.loge - - - name: Request changes if tests failed - if: failure() # Only runs if the test step fails - run: | - curl -X POST \ - -H "Authorization: token ${{ secrets.GH_BOT_PAT }}" \ - -H "Accept: application/vnd.github.v3+json" \ - https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews \ - -d '{ - "body": "🚨 Your pull request failed the tests. Please fix them before we can merge.", - "event": "REQUEST_CHANGES" - }' diff --git a/.github/workflows/code-tester.yml b/.github/workflows/code-tester.yml new file mode 100644 index 0000000..56c525a --- /dev/null +++ b/.github/workflows/code-tester.yml @@ -0,0 +1,25 @@ +name: Pull Request Review Bot + +on: + pull_request: + branch: [ master ] + +jobs: + test: + runs-on: ubuntu-latest + + steps: + - name: Download Repo In Docker + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install dependencies + run: pip install -r requirements.txt + + - name: Run tests and save output + id: test + run: pytest