Skip to content

Commit

Permalink
added github work flows
Browse files Browse the repository at this point in the history
  • Loading branch information
RamakrushnaBiswal committed Sep 21, 2024
1 parent aa97740 commit 102ea00
Show file tree
Hide file tree
Showing 13 changed files with 478 additions and 77 deletions.
16 changes: 2 additions & 14 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,3 @@
# These are supported funding model platforms
#support us
github:[RamakrushnaBiswal]

github:[RamakrushnaBiswal] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "🐞 Bug Report"
description: "Create a report to help us improve"
title: "BUG:"
labels: ["bug"]
body:
- type: checkboxes
attributes:
label: "Is there an existing issue for this?"
description: "Please search to see if an issue already exists for the bug you encountered."
options:
- label: "I have searched the existing issues"
required: true
- type: textarea
attributes:
label: "What went down?"
description: "A concise description of what you're experiencing."
validations:
required: true
- type: checkboxes
attributes:
label: "Record"
options:
- label: "I agree to follow this project's Code of Conduct"
required: true
- label: "I'm a gssoc-24-extd contributor"
- label: "I want to work on this issue"
- label: "I check the issue doesn't exist"
28 changes: 28 additions & 0 deletions .github/ISSUE_TEMPLATE/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: " 📄PlayCafe-Docs"
description: "Improve Documentation"
title: "Topic:"
labels:
- "PlayCafe Documentation"
body:
- type: textarea
attributes:
label: "Describe the types of topics you'd add in our Website"
description: "Describe in 30 words or more."
validations:
required: true

- type: textarea
attributes:
label: "Could you share some screenshots or a video of your previous work?"
description: "It would be great to know what areas you'd like to contribute to"
validations:
required: false

- type: checkboxes
attributes:
label: "Record"
options:
- label: "I agree to follow this project's Code of Conduct"
required: true
- label: "I'm a GSSOC-24-extd contributor"
- label: "Soon, I'll complete it and create a Pull Request."
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "✨ Feature Request"
description: "Suggest an idea for this project "
title: "Feat:"
labels: [enhancement]
body:
- type: textarea
attributes:
label: "Describe the feature"
description:
validations:
required: true
- type: textarea
attributes:
label: "Add ScreenShots"
description: "Add sufficient SS to explain your issue."
validations:
required: true
- type: checkboxes
attributes:
label: "Record"
options:
- label: "I agree to follow this project's Code of Conduct"
required: true
- label: "I'm a gssoc-24-extd contributor"
- label: "I want to work on this issue"
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/project.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: "📝 Playcafe Project Proposal"
description: "Suggest a new thing we can add our project"
title: "Project Proposal: "
labels: [project, enhancement]
body:
- type: textarea
attributes:
label: "Overview"
description: "What is the goal of the project? And which type of technology you are using?"
validations:
required: true

- type: textarea
attributes:
label: "Key Features"
description: "List the key features and functionalities that this project will include."
validations:
required: false

- type: textarea
attributes:
label: "Additional Information"
description: "Any extra details or context."
validations:
required: false

- type: checkboxes
attributes:
label: "Record"
options:
- label: "I agree to follow this project's Code of Conduct"
required: true
- label: "I'm a gssoc-24-extd contributor"
- label: "I want to work on this project proposal"
- label: "It is not duplicate"
63 changes: 0 additions & 63 deletions .github/Issue-template

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/autocomment-iss-close.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Comment on Issue Close

on:
issues:
types: [closed]

jobs:
greet-on-close:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Greet User
uses: actions/github-script@v5
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const issue = context.payload.issue;
const issueCreator = issue.user.login;
const issueNumber = issue.number;
const greetingMessage = `Hello @${issueCreator}! Your issue #${issueNumber} has been closed. Thank you for your contribution!🚀`;
github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: greetingMessage
});
36 changes: 36 additions & 0 deletions .github/workflows/autocomment-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Auto Comment on Issue

on:
issues:
types: [opened]

permissions:
issues: write

jobs:
comment:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Add Comment to Issue
run: |
COMMENT=$(cat <<EOF
{
"body": "Thank you for creating this issue! 🎉 We'll look into it as soon as possible. In the meantime, please make sure to provide all the necessary details and context. If you have any questions or additional information, feel free to add them here. Your contributions are highly appreciated! 😊\n\nYou can also check our [CONTRIBUTING.md](https://github.com/RamakrushnaBiswal/PlayCafe/blob/main/CONTRIBUTING.md) for guidelines on contributing to this project. \n for more information join our discord https://discord.gg/Jh3bWQ7FRN"
}
EOF
)
RESPONSE=$(curl -s -o response.json -w "%{http_code}" \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments \
-d "$COMMENT")
cat response.json
if [ "$RESPONSE" -ne 201 ]; then
echo "Failed to add comment"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 changes: 38 additions & 0 deletions .github/workflows/autocomment-pr-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Auto Comment on PR Merge

on:
pull_request:
types: [closed]

permissions:
issues: write
pull-requests: write

jobs:
comment:
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: github.event.pull_request.merged == true

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Add Comment to Issue
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
COMMENT=$(cat <<EOF
{
"body": "🎉 Your pull request has been successfully merged! \n
Star ⭐ the repo \n
🎉 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! 🚀"
}
EOF
)
curl -X POST \
-H "Authorization: Bearer $GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-d "$COMMENT"
37 changes: 37 additions & 0 deletions .github/workflows/autocomment-pr-raise.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Auto Comment on PR

on:
pull_request_target:
types: [opened]

permissions:
issues: write
pull-requests: write

jobs:
comment:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Add Comment to Pull Request
run: |
COMMENT=$(cat <<EOF
{
"body": "Thank you for submitting your pull request! 🙌 We'll review it as soon as possible. In the meantime, please ensure that your changes align with our [CONTRIBUTING.md](https://github.com/RamakrushnaBiswal/PlayCafe/blob/main/CONTRIBUTING.md). If there are any specific instructions or feedback regarding your PR, we'll provide them here. Thanks again for your contribution! 😊"
}
EOF
)
RESPONSE=$(curl -s -o response.json -w "%{http_code}" \
-X POST \
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments \
-d "$COMMENT")
cat response.json
if [ "$RESPONSE" -ne 201 ]; then
echo "Failed to add comment"
exit 1
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/close-old-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Close Old Issues
on:
schedule:
- cron: "0 0 * * *"

jobs:
close-issues:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Close Old Issues
run: |
open_issues=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues?state=open" \
| jq -r '.[] | .number')
for issue in $open_issues; do
# Get the last updated timestamp of the issue
last_updated=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/issues/$issue" \
| jq -r '.updated_at')
days_since_update=$(( ( $(date +%s) - $(date -d "$last_updated" +%s) ) / 86400 ))
if [ $days_since_update -gt 30 ]; then
curl -s -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d '{"state":"closed"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/$issue"
# Add a comment explaining when the issue will be closed
curl -s -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-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!"}' \
"https://api.github.com/repos/${{ github.repository }}/issues/$issue/comments"
fi
done
Loading

0 comments on commit 102ea00

Please sign in to comment.