Skip to content

Commit 64a3e11

Browse files
authored
Merge branch 'Recode-Hive:main' into change-in-issue-templates
2 parents c418248 + 8c68176 commit 64a3e11

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+288079
-4175
lines changed

.github/ISSUE_TEMPLATE/invitation.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Invitation to the Recode-Hive GitHub Community Organization
2+
description: I would like to be part of this awesome community
3+
title: "Please invite me to the Recode-Hive GitHub Community Organization"
4+
labels: [invite me to the community]
5+
body:
6+
- type: input
7+
id: name
8+
attributes:
9+
label: Name
10+
placeholder: Insert your name here
11+
validations:
12+
required: true
13+
- type: input
14+
id: discordname
15+
attributes:
16+
label: Discord Username (if applicable)
17+
placeholder: Insert your Discord username here
18+
validations:
19+
required: false
20+
- type: textarea
21+
id: Additional
22+
attributes:
23+
label: Additional Context
24+
description: What do you like about this community/Why do you want to join?
25+
validations:
26+
required: false
27+
- type: markdown
28+
attributes:
29+
value: |
30+
Feel free to check out other cool repositories of the Recode-Hive Community [here](https://github.com/Recode-Hive)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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+
});
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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"

.github/workflows/close-old-issue.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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

.github/workflows/close-old-pr.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Close Stale PRs Without Owner Comments
2+
3+
on:
4+
schedule:
5+
- cron: "0 0 * * *" # Runs daily at midnight
6+
7+
jobs:
8+
close_stale_prs:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check out the repository
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Close Stale PRs Without Owner Comments
18+
run: |
19+
const daysThreshold = 30;
20+
const github = require('@actions/github');
21+
const { Octokit } = require('@octokit/rest');
22+
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
23+
const owner = github.context.repo.owner;
24+
const repo = github.context.repo.repo;
25+
const now = new Date();
26+
const thresholdDate = new Date(now.setDate(now.getDate() - daysThreshold));
27+
28+
async function run() {
29+
const { data: pullRequests } = await octokit.pulls.list({ owner, repo, state: 'open' });
30+
for (const pr of pullRequests) {
31+
const { data: comments } = await octokit.issues.listComments({ owner, repo, issue_number: pr.number });
32+
const ownerComments = comments.filter(comment => comment.user.login === owner);
33+
const recentOwnerComment = ownerComments.find(comment => new Date(comment.created_at) > thresholdDate);
34+
35+
if (!recentOwnerComment) {
36+
await octokit.pulls.update({ owner, repo, pull_number: pr.number, state: 'closed' });
37+
await octokit.issues.createComment({
38+
owner,
39+
repo,
40+
issue_number: pr.number,
41+
body: "This pull request has been closed because there has been no comment from the repository owner for the last 30 days. Please reach out to the maintainers if you have any questions."
42+
});
43+
}
44+
}
45+
}
46+
47+
run().catch(err => {
48+
console.error(err);
49+
process.exit(1);
50+
});
51+
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/greetings.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Greetings
2+
3+
on: [pull_request_target, issues]
4+
5+
jobs:
6+
greeting:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
issues: write
10+
pull-requests: write
11+
steps:
12+
- uses: actions/first-interaction@v1
13+
with:
14+
repo-token: ${{ secrets.GITHUB_TOKEN }}
15+
issue-message: "Hi there! Thanks for opening this issue. We appreciate your contribution to this open-source project. We aim to respond or assign your issue as soon as possible."
16+
pr-message: "Welcome to Our repository.🎊 Thank you so much for taking the time to point this out."

.github/workflows/invitation.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Automate Invitation
2+
3+
on:
4+
issues:
5+
types: [labeled]
6+
7+
jobs:
8+
handle_label:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Check if Label is 'invite me to the community'
13+
id: check_label
14+
run: |
15+
if [[ "${{ github.event.label.name }}" != "invite me to the community" ]]; then
16+
echo "Label is not 'invite me to the community'. Exiting."
17+
exit 0
18+
fi
19+
20+
- name: Create Issue in Support Repository
21+
id: create_issue
22+
if: ${{ steps.check_label.outcome == 'success' }}
23+
uses: actions/github-script@v5
24+
with:
25+
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
26+
script: |
27+
const issue = context.payload.issue;
28+
const { owner, repo } = context.repo;
29+
const response = await github.rest.issues.create({
30+
owner: 'Recode-Hive',
31+
repo: 'Support',
32+
title: issue.title,
33+
body: issue.body,
34+
labels: ['invite me to the community'],
35+
});
36+
core.setOutput('issue_number', response.data.number);
37+
38+
- name: Close Original Issue in StackOverflow Repository
39+
if: ${{ steps.check_label.outcome == 'success' }}
40+
uses: actions/github-script@v5
41+
with:
42+
github-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
43+
script: |
44+
const issue = context.payload.issue;
45+
await github.rest.issues.update({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
issue_number: issue.number,
49+
state: 'closed'
50+
});
51+
52+
- name: Invite on Label
53+
if: ${{ steps.check_label.outcome == 'success' }}
54+
uses: vj-abigo/[email protected]
55+
with:
56+
organization: Recode-Hive
57+
label: invite me to the community
58+
repo-token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
59+
comment: |
60+
<b>Invitation sent to join the GitHub Organisation. Welcome to the community 🎉</b><br><br>
61+
Don't forget after accepting to make it public so it appears on your GitHub profile for everyone else to see. You can do this by finding your name in the GitHub organisation list and change the dropdown to public https://github.com/orgs/Recode-Hive/people<br><br>
62+
I hope that helps
63+
env:
64+
INVITE_TOKEN: ${{ secrets.INVITE_TOKEN }

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
catboost_info/

.vscode/settings.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"githubPullRequests.ignoredPullRequestBranches": [
3+
"main"
4+
]
5+
}

0 commit comments

Comments
 (0)