-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add not-accepted github workflow
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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).` | ||
}); | ||
} |