From 05ce73a484983de36e1cf7483495d9ad4df4406d Mon Sep 17 00:00:00 2001 From: yzqzss <30341059+yzqzss@users.noreply.github.com> Date: Sat, 30 Dec 2023 17:00:45 +0800 Subject: [PATCH] Update and rename ban_README_edit to ban_README_edit.yml --- .github/workflows/ban_README_edit | 22 ---------------------- .github/workflows/ban_README_edit.yml | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 22 deletions(-) delete mode 100644 .github/workflows/ban_README_edit create mode 100644 .github/workflows/ban_README_edit.yml diff --git a/.github/workflows/ban_README_edit b/.github/workflows/ban_README_edit deleted file mode 100644 index 8738d5d..0000000 --- a/.github/workflows/ban_README_edit +++ /dev/null @@ -1,22 +0,0 @@ -name: Close PR on README.md change - -on: - pull_request: - types: [edited] - -jobs: - close_pr: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v2 - - name: Check for README.md changes - run: | - if git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep -q "^README.md$"; then - echo "README.md has been modified. Closing the PR." - curl -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -d '{"state":"closed"}' "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" - else - echo "No changes to README.md. Nothing to do." - fi - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/ban_README_edit.yml b/.github/workflows/ban_README_edit.yml new file mode 100644 index 0000000..9fab972 --- /dev/null +++ b/.github/workflows/ban_README_edit.yml @@ -0,0 +1,15 @@ +name: Close PR on README changes + +on: + pull_request: + paths: + - 'README.md' + +jobs: + close-pr: + runs-on: ubuntu-latest + steps: + - name: Close PR if README.md changed + uses: peter-evans/close-pull@v3.0.1 + with: + comment: do not edit README.md