Open razakpm opened 1 week ago
This guide describes how to set up a GitHub Action that automatically sends an email for all open GitHub Issues that have not been touched for more than 12 hours, using an email domain hosted in Office 365 (techbd.org).
# .github/workflows/notify-inactive-issues.yml
name: Notify Inactive Issues
on:
schedule:
- cron: '0 * * * *' # Runs every hour, adjust as necessary
jobs:
notify_inactive_issues:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v2
- name: Fetch open issues
id: fetch_issues
run: |
curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/issues?state=open" | jq '[.[] | select((now - (.updated_at | fromdateiso8601)) > (12 * 60 * 60))]' > inactive_issues.json
- name: Send email if there are inactive issues
if: success()
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.office365.com # Office 365 SMTP server
server_port: 587
username: ${{ secrets.OFFICE365_USERNAME }} # Office 365 email address
password: ${{ secrets.OFFICE365_PASSWORD }} # Office 365 app-specific password or regular password
subject: "GitHub Issues Notification"
to: "help@diabetestechnology.org"
from: "noreply@diabetestechnology.org" # Sender email from diabetestechnology.org domain
content_type: text/plain
body: |
The following issues have been inactive for more than 12 hours:
${{ steps.fetch_issues.outputs.inactive_issues }}