From ef0caba61bd7f66a9148843da5fec4b4a491d78f Mon Sep 17 00:00:00 2001 From: Niels Provos Date: Fri, 30 Aug 2024 15:19:01 -0700 Subject: [PATCH] chore: Add GitHub Actions step to comment on PRs for successful tests and linting --- .github/workflows/ci_cd.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.yml index 2ca3917..cbcb037 100644 --- a/.github/workflows/ci_cd.yml +++ b/.github/workflows/ci_cd.yml @@ -28,6 +28,18 @@ jobs: - name: Run tests run: | poetry run pytest + - name: Comment PR + uses: actions/github-script@v6 + if: github.event_name == 'pull_request' + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.name, + body: '✅ Tests passed for Python ${{ matrix.python-version }}!' + }) lint: runs-on: ubuntu-latest @@ -45,6 +57,18 @@ jobs: run: | poetry run flake8 . poetry run black --check . + - name: Comment PR + uses: actions/github-script@v6 + if: github.event_name == 'pull_request' + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.name, + body: '✅ Linting passed!' + }) publish: needs: [test, lint]