Skip to content

Commit

Permalink
Merge branch 'Counselllor:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
sau-mili authored May 25, 2024
2 parents c26d913 + 5a0e801 commit 3a53cc2
Show file tree
Hide file tree
Showing 8 changed files with 207 additions and 16 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/autocomment-pr-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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! 🎉 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/Sayak-Bhunia/mystory/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 }}
45 changes: 45 additions & 0 deletions .github/workflows/close-old-issue.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
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: |
# Fetch all open issues
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')
# Calculate the number of days since the issue was last updated
days_since_update=$(( ( $(date +%s) - $(date -d "$last_updated" +%s) ) / 86400 ))
# If the issue has been inactive for more than 30 days, close it
if [ $days_since_update -gt 30 ]; then
# Close the issue
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 why the issue was 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
35 changes: 35 additions & 0 deletions .github/workflows/close-old-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Close Stale PRs

on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight UTC
pull_request:
types:
- opened
- reopened
- synchronize

permissions:
pull-requests: write
issues: write

jobs:
close-stale-prs:
runs-on: ubuntu-latest
permissions:
pull-requests: write

steps:
- name: Close Stale PRs
uses: actions/stale@v7
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-pr-message: 'This PR has been automatically closed due to inactivity from the owner for 15 days.'
days-before-pr-stale: 15
days-before-pr-close: 0
exempt-pr-author: false
exempt-pr-labels: ''
only-labels: ''
operations-per-run: 30
remove-stale-when-updated: true
debug-only: false
37 changes: 37 additions & 0 deletions .github/workflows/close-on-merge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Close Issues on PR Merge

on:
pull_request:
types: [closed]

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

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

- name: Close linked issues
if: github.event.pull_request.merged == true
run: |
# Extract issue numbers from the PR body
ISSUES=$(jq -r '.pull_request.body' "$GITHUB_EVENT_PATH" | grep -Eo '#[0-9]+' | tr -d '#')
# Loop through each extracted issue number and close the issue
for ISSUE in $ISSUES
do
echo "Closing issue #$ISSUE"
# Post a comment to the issue indicating it was closed by the merged PR
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE/comments \
-d "{\"body\":\"Closed by PR #${{ github.event.pull_request.number }}\"}"
# Close the issue by updating its state to "closed"
curl -X PATCH -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE \
-d "{\"state\":\"closed\"}"
done
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"uid": "^2.0.2"
},
"devDependencies": {
"@types/react": "^18.3.2",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"@vitejs/plugin-react": "^4.3.0",
"vite": "^5.2.11"
Expand Down
17 changes: 9 additions & 8 deletions src/components/Dashboard/Dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@

.search {
width: 70vw;
background-color: #5CB6F9;
background-color: #76c6f5;
padding: 10px;
border-radius: 15px;
margin: 0 auto;
Expand All @@ -303,34 +303,35 @@
top: 1px;
right: -25px;
border-left: 2px solid #306094;
height: 70px;
height: 72px;
}

.search img {
width: 30px;
height: 36px;
width: 35px;
height: 39px;
position: relative;
top: 18px;
right: -10px;
right: -6px;
color: #306094;
}

.search input {
width: 78%;
height: 70px;
background-color: #5CB6F9;
background-color: #e4f1fe;
appearance: none;
border: none;
border-radius: 15px;
font-size: 25px;
font-family: 'ABeeZee';
color: #F4F6FC;
color: #25376e;
padding-left: 35px;
margin-left: 40px;
margin-right: 15px;
}

.search input::placeholder {
color: white;
color: rgb(198, 190, 190);
}

.search button {
Expand Down

0 comments on commit 3a53cc2

Please sign in to comment.