diff --git a/.github/workflows/close-tagged-pr.yml b/.github/workflows/close-tagged-pr.yml new file mode 100644 index 0000000000..55e325c33e --- /dev/null +++ b/.github/workflows/close-tagged-pr.yml @@ -0,0 +1,37 @@ +name: Auto-Close PRs with Specific Tag + +on: + pull_request: + types: [opened, labeled] + +jobs: + close_pr: + runs-on: ubuntu-latest + steps: + - name: Check PR Labels + id: check-label + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const prNumber = context.payload.pull_request.number; + const labels = context.payload.pull_request.labels.map(label => label.name); + const forbiddenLabel = "not-accepted"; + + if (labels.includes(forbiddenLabel)) { + await github.rest.pulls.update({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + state: "closed" + }); + + await github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: prNumber, + body: `**Thank you for your pull request and changes.** + Due to a change in our contribution guideline policy, we are closing this pull request as it does not meet the contribution criteria. + Please [see here for more details](https://github.com/Consensys/gnark/blob/master/CONTRIBUTING.md#guidelines-for-non-code-and-other-trivial-contributions).` + }); + } \ No newline at end of file