From 36dd2718a3f9875e38eefd5d3b42aadd0fb1b6c0 Mon Sep 17 00:00:00 2001 From: Isaac Miller Date: Thu, 7 Mar 2024 16:04:29 -0600 Subject: [PATCH 1/3] Add main push action back and fix comment bot --- .github/workflows/pr_comment.yml | 3 ++- .github/workflows/run_tests.yml | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr_comment.yml b/.github/workflows/pr_comment.yml index 87afb50947..09944da543 100644 --- a/.github/workflows/pr_comment.yml +++ b/.github/workflows/pr_comment.yml @@ -2,13 +2,14 @@ name: Comment for PR on: workflow_run: - workflows: ["Check for Ruff Fix, Test, and Build"] + workflows: ["Lint, Test, and Build"] types: - completed jobs: comment: runs-on: ubuntu-latest + if: github.event.workflow_run.event == 'pull_request' steps: - name: "Download Ruff Fix Outcome Artifact" uses: actions/download-artifact@v2 diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index e57c6ff0f1..64cbd84e35 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -1,6 +1,9 @@ name: Lint, Test, and Build on: + push: + branches: + - main pull_request: types: [opened, synchronize, reopened] @@ -52,7 +55,6 @@ jobs: strategy: matrix: python-version: ["3.9"] - if: github.event_name == 'pull_request' steps: - uses: actions/checkout@v4 - name: Load cached Poetry installation @@ -84,7 +86,6 @@ jobs: strategy: matrix: python-version: ["3.9"] - if: github.event_name == 'pull_request' steps: - uses: actions/checkout@v4 - name: Load cached Poetry installation @@ -116,7 +117,6 @@ jobs: strategy: matrix: python-version: ["3.9"] - if: github.event_name == 'pull_request' steps: - uses: actions/checkout@v4 - name: Load cached Poetry installation From 8c106014c45cea478962bf4c9516e7fbc9a6f0f1 Mon Sep 17 00:00:00 2001 From: Isaac Miller Date: Thu, 7 Mar 2024 16:14:19 -0600 Subject: [PATCH 2/3] Try to fix comment bot --- .github/workflows/pr_comment.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pr_comment.yml b/.github/workflows/pr_comment.yml index 09944da543..3e4fb678d7 100644 --- a/.github/workflows/pr_comment.yml +++ b/.github/workflows/pr_comment.yml @@ -3,8 +3,7 @@ name: Comment for PR on: workflow_run: workflows: ["Lint, Test, and Build"] - types: - - completed + types: [completed] jobs: comment: From 69b5cb545a78acb4ada7b2f1c9b7b2b46a184dce Mon Sep 17 00:00:00 2001 From: Isaac Miller Date: Thu, 7 Mar 2024 16:22:16 -0600 Subject: [PATCH 3/3] Remove comment bot workflow - to be added later --- .github/workflows/pr_comment.yml | 37 -------------------------------- .github/workflows/run_tests.yml | 15 ------------- 2 files changed, 52 deletions(-) delete mode 100644 .github/workflows/pr_comment.yml diff --git a/.github/workflows/pr_comment.yml b/.github/workflows/pr_comment.yml deleted file mode 100644 index 3e4fb678d7..0000000000 --- a/.github/workflows/pr_comment.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Comment for PR - -on: - workflow_run: - workflows: ["Lint, Test, and Build"] - types: [completed] - -jobs: - comment: - runs-on: ubuntu-latest - if: github.event.workflow_run.event == 'pull_request' - steps: - - name: "Download Ruff Fix Outcome Artifact" - uses: actions/download-artifact@v2 - with: - name: ruff-fix-outcome - path: artifacts - - - name: "Read Ruff Fix Outcome" - id: ruff_outcome - run: | - outcome=$(cat artifacts/ruff_fix_outcome.txt) - echo "RUFF_FIX_OUTCOME=$outcome" >> $GITHUB_ENV - - - name: "Comment on PR if Ruff Fix Failed" - if: env.RUFF_FIX_OUTCOME == 'true' - uses: actions/github-script@v5 - with: - script: | - const pr_number = ${{ github.event.workflow_run.pull_requests[0].number }}; - const message = 'It seems like there are issues with the formatting. Please run `ruff check . --fix-only` and commit to address these issues.'; - github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr_number, - body: message - }); diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index 64cbd84e35..96e81e381e 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -27,21 +27,6 @@ jobs: args: --fix-only --exit-non-zero-on-fix continue-on-error: true - - name: Determine Ruff Fix Outcome - run: | - if [ ${{ steps.ruff_fix.outcome }} == 'failure' ]; then - echo "RUFF_FAILED=true" >> $GITHUB_ENV - echo ${{ steps.ruff_fix.outcome }} > ruff_fix_outcome.txt - else - echo "RUFF_FAILED=false" >> $GITHUB_ENV - echo ${{ steps.ruff_fix.outcome }} > ruff_fix_outcome.txt - fi - - - uses: actions/upload-artifact@v2 - with: - name: ruff-fix-outcome - path: ruff_fix_outcome.txt - - name: Fail Workflow if Ruff Fix Failed if: steps.ruff_fix.outcome == 'failure' run: |