Skip to content

Commit

Permalink
chore: add not-accepted github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
gbotrel committed Feb 18, 2025
1 parent e55bdc2 commit cd0f10e
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/close-tagged-pr.yml
Original file line number Diff line number Diff line change
@@ -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).`
});
}

0 comments on commit cd0f10e

Please sign in to comment.