Skip to content

Commit

Permalink
Merge branch 'Akshat111111:main' into feat/crude_oil_analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
Amarta113 authored May 19, 2024
2 parents 18603ee + 67d73b7 commit 1b980c4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ We use GitHub issues to manage tasks. Feel free to open an issue for bugs, sugge

## Code of Conduct 🤝

We maintain a Code of Conduct to ensure a welcoming environment for all contributors. Please review and follow our [Code of Conduct](link_to_code_of_conduct).
We maintain a Code of Conduct to ensure a welcoming environment for all contributors. Please review and follow our [Code of Conduct](https://github.com/Akshat111111/Hedging-of-Financial-Derivatives/blob/main/Code-of-conduct.md).

Thank you for your interest in contributing to the Financial Derivative Hedging Project! 🙌

Expand Down

0 comments on commit 1b980c4

Please sign in to comment.