From 2130a8c57cf144fb43f26e114d1928cfaa83be3d Mon Sep 17 00:00:00 2001 From: manami-project <13179375+manami-project@users.noreply.github.com> Date: Wed, 12 Feb 2025 20:20:38 +0100 Subject: [PATCH] Replaced close-pull-request with custom implementation allowing to ignore dependabot PRs --- .github/workflows/close-pr.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/close-pr.yml b/.github/workflows/close-pr.yml index 438a0562c..cfec6bfd0 100644 --- a/.github/workflows/close-pr.yml +++ b/.github/workflows/close-pr.yml @@ -2,12 +2,22 @@ name: Close Pull Request on: pull_request_target: - types: [opened] + types: [opened, synchronize, reopened, edited] jobs: run: runs-on: ubuntu-latest steps: - - uses: superbrothers/close-pull-request@v3 - with: - comment: "The content of this repo is completely generated. Therefore PRs are not accepted. You can check the [issue templates](https://github.com/manami-project/anime-offline-database/issues/new/choose) if you want to report something." \ No newline at end of file + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Close PR if it is not from Dependabot + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + if [[ "${{ github.actor }}" == "dependabot[bot]" ]]; then + echo "The content of this repo is completely generated. Therefore PRs are not accepted. You can check the [issue templates](https://github.com/manami-project/anime-offline-database/issues/new/choose) if you want to report something." + exit 0 + fi + echo "Closing the PR as it's not from Dependabot." + gh pr close ${{ github.event.pull_request.number }} --comment "Automatically closing this PR" --delete-branch