-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
1,353 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,38 @@ | ||
### Description | ||
A clear and concise description of what the PR does. | ||
- This PR does the following: | ||
- Adds ... | ||
- Fixes ... | ||
- Updates ... | ||
|
||
### Related Issues | ||
Link any related issues using the format `Fixes #issue_number`. | ||
This helps to automatically close related issues when the PR is merged. | ||
- Placeholder: "Fixes #123" | ||
|
||
### Changes | ||
List the detailed changes made in this PR. | ||
- Added a new feature to ... | ||
- Refactored the ... | ||
- Fixed a bug in ... | ||
|
||
### Testing Instructions | ||
Detailed instructions on how to test the changes. Include any setup needed and specific test cases. | ||
1. Pull this branch. | ||
2. Run `npm install` to install dependencies. | ||
3. Run `npm test` to execute the test suite. | ||
4. Verify that ... | ||
|
||
### Screenshots (if applicable) | ||
Add any screenshots that help explain or visualize the changes. | ||
|
||
### Additional Context | ||
Any additional context or information that reviewers should be aware of. | ||
- This PR is based on the following... | ||
|
||
### Checklist | ||
Make sure to check off all the items before submitting. Mark with [x] if done. | ||
- [ ] I have performed a self-review of my code | ||
- [ ] I have commented my code, particularly in hard-to-understand areas | ||
- [ ] My changes generate no new warnings | ||
- [ ] I am working on this issue under GSSOC |
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,53 @@ | ||
name: Close Stale PRs Without Owner Comments | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" # Runs daily at midnight | ||
|
||
jobs: | ||
close_stale_prs: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Close Stale PRs Without Owner Comments | ||
run: | | ||
const daysThreshold = 7; | ||
const github = require('@actions/github'); | ||
const { Octokit } = require('@octokit/rest'); | ||
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN }); | ||
const owner = github.context.repo.owner; | ||
const repo = github.context.repo.repo; | ||
const now = new Date(); | ||
const thresholdDate = new Date(now.setDate(now.getDate() - daysThreshold)); | ||
async function run() { | ||
const { data: pullRequests } = await octokit.pulls.list({ owner, repo, state: 'open' }); | ||
for (const pr of pullRequests) { | ||
const { data: comments } = await octokit.issues.listComments({ owner, repo, issue_number: pr.number }); | ||
const ownerComments = comments.filter(comment => comment.user.login === owner); | ||
const recentOwnerComment = ownerComments.find(comment => new Date(comment.created_at) > thresholdDate); | ||
if (!recentOwnerComment) { | ||
await octokit.pulls.update({ owner, repo, pull_number: pr.number, state: 'closed' }); | ||
await octokit.issues.createComment({ | ||
owner, | ||
repo, | ||
issue_number: pr.number, | ||
body: "This pull request has been closed because there has been no comment from the repository owner for the last 7 days. Please reach out to the maintainers if you have any questions." | ||
}); | ||
} | ||
} | ||
} | ||
run().catch(err => { | ||
console.error(err); | ||
process.exit(1); | ||
}); | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Oops, something went wrong.