From a065640523f1368f64e183df536b61c769a5e8f2 Mon Sep 17 00:00:00 2001 From: William Harrison Date: Wed, 24 Apr 2024 12:36:19 +0800 Subject: [PATCH] Update checks.yml --- .github/workflows/checks.yml | 30 ++++-------------------------- 1 file changed, 4 insertions(+), 26 deletions(-) diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index 370ffce74..eb0ff8ebb 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -1,4 +1,5 @@ name: Checks + on: [pull_request, workflow_dispatch] jobs: @@ -13,29 +14,6 @@ jobs: with: bun-version: latest - run: bun install - - run: bun test - continue-on-error: true - - name: Check if validation failed - run: | - if [ $? -ne 0 ]; then - echo "::set-output name=validation_failed::true" - else - echo "::set-output name=validation_failed::false" - fi - id: check_validation - - name: Close pull request if validation failed - if: steps.check_validation.outputs.validation_failed == 'true' - run: | - curl -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d '{"state":"closed"}' \ - "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" - - name: Comment on closed pull request - if: steps.check_validation.outputs.validation_failed == 'true' - run: | - curl -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Content-Type: application/json" \ - -d '{"body": "Due to high amounts of pull requests and not enough resources to review all, we are automatically closing pull requests that fail checks. Please read the [documentation](https://www.is-a.dev/docs) to ensure your file format is correct. If you still are encountering issues, please join our [Discord server](https://discord.gg/is-a-dev-830872854677422150) and open a help thread."}' \ - "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments" + - run: bun test || (echo 'Tests failed, closing pull request.' && gh pr close --comment "Due to high amounts of pull requests and not enough resources to review all, we are automatically closing pull requests that fail checks. Please read the documention (https://www.is-a.dev/docs) to ensure your file format is correct. If you still are encountering issues, please join our [Discord server](https://discord.gg/is-a-dev-830872854677422150) and open a help thread.") + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}