This repository was archived by the owner on Jun 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +136
-0
lines changed Expand file tree Collapse file tree 4 files changed +136
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Comment on Issue Close
2
+
3
+ on :
4
+ issues :
5
+ types : [closed]
6
+
7
+ jobs :
8
+ greet-on-close :
9
+ runs-on : ubuntu-latest
10
+ permissions :
11
+ issues : write
12
+ steps :
13
+ - name : Greet User
14
+ uses : actions/github-script@v5
15
+ with :
16
+ github-token : ${{ secrets.GITHUB_TOKEN }}
17
+ script : |
18
+ const issue = context.payload.issue;
19
+ const issueCreator = issue.user.login;
20
+ const issueNumber = issue.number;
21
+
22
+ const greetingMessage = `Hello @${issueCreator}! Your issue #${issueNumber} has been closed. Thank you for your contribution!`;
23
+
24
+ github.rest.issues.createComment({
25
+ owner: context.repo.owner,
26
+ repo: context.repo.repo,
27
+ issue_number: issueNumber,
28
+ body: greetingMessage
29
+ });
Original file line number Diff line number Diff line change
1
+ name : Auto Comment on PR Merge
2
+
3
+ on :
4
+ pull_request :
5
+ types : [closed]
6
+
7
+ permissions :
8
+ issues : write
9
+ pull-requests : write
10
+
11
+ jobs :
12
+ comment :
13
+ runs-on : ubuntu-latest
14
+ permissions :
15
+ pull-requests : write
16
+ if : github.event.pull_request.merged == true
17
+
18
+ steps :
19
+ - name : Checkout Repository
20
+ uses : actions/checkout@v2
21
+
22
+ - name : Add Comment to Issue
23
+ env :
24
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
25
+ run : |
26
+ COMMENT=$(cat <<EOF
27
+ {
28
+ "body": "🎉 Your pull request has been successfully merged! 🎉 Thank you for your valuable contribution to our project. Your efforts are greatly appreciated. Feel free to reach out if you have any more contributions or if there's anything else we can assist you with. Keep up the fantastic work! 🚀"
29
+ }
30
+ EOF
31
+ )
32
+ curl -X POST \
33
+ -H "Authorization: Bearer $GITHUB_TOKEN" \
34
+ -H "Accept: application/vnd.github.v3+json" \
35
+ https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
36
+ -d "$COMMENT"
Original file line number Diff line number Diff line change
1
+ name : Close Old Issues
2
+ on :
3
+ schedule :
4
+ - cron : " 0 0 * * *"
5
+
6
+ jobs :
7
+ close-issues :
8
+ runs-on : ubuntu-latest
9
+
10
+ steps :
11
+ - name : Checkout Repository
12
+ uses : actions/checkout@v4
13
+
14
+ - name : Close Old Issues
15
+ run : |
16
+ open_issues=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
17
+ "https://api.github.com/repos/${{ github.repository }}/issues?state=open" \
18
+ | jq -r '.[] | .number')
19
+ for issue in $open_issues; do
20
+ # Get the last updated timestamp of the issue
21
+ last_updated=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
22
+ "https://api.github.com/repos/${{ github.repository }}/issues/$issue" \
23
+ | jq -r '.updated_at')
24
+ days_since_update=$(( ( $(date +%s) - $(date -d "$last_updated" +%s) ) / 86400 ))
25
+ if [ $days_since_update -gt 30 ]; then
26
+ curl -s -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
27
+ -H "Accept: application/vnd.github.v3+json" \
28
+ -d '{"state":"closed"}' \
29
+ "https://api.github.com/repos/${{ github.repository }}/issues/$issue"
30
+
31
+ # Add a comment explaining when the issue will be closed
32
+ curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
33
+ -H "Accept: application/vnd.github.v3+json" \
34
+ -d '{"body":"This issue has been automatically closed because it has been inactive for more than 30 days. If you believe this is still relevant, feel free to reopen it or create a new one. Thank you!"}' \
35
+ "https://api.github.com/repos/${{ github.repository }}/issues/$issue/comments"
36
+ fi
37
+ done
Original file line number Diff line number Diff line change
1
+ name : Close Stale PRs
2
+
3
+ on :
4
+ schedule :
5
+ - cron : ' 0 0 * * *' # Runs daily at midnight
6
+ pull_request :
7
+ types :
8
+ - opened
9
+ - reopened
10
+ - synchronize
11
+
12
+ permissions :
13
+ pull-requests : write
14
+ issues : write
15
+
16
+ jobs :
17
+ close_stale_prs :
18
+ runs-on : ubuntu-latest
19
+ permissions :
20
+ pull-requests : write
21
+
22
+ steps :
23
+ - uses : actions/stale@v7
24
+ with :
25
+ repo-token : ${{ secrets.GITHUB_TOKEN }}
26
+ stale-pr-message : ' This PR has been automatically closed due to inactivity from the owner for 15 days.'
27
+ days-before-pr-stale : 15
28
+ days-before-pr-close : 0
29
+ exempt-pr-author : false
30
+ exempt-pr-labels : ' '
31
+ only-labels : ' '
32
+ operations-per-run : 30
33
+ remove-stale-when-updated : true
34
+ debug-only : false
You can’t perform that action at this time.
0 commit comments