forked from Curious-Ecosystem/Curious-Connect
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Curious-Ecosystem#183 from RishitaChourey/main
[issueReminder.yml]- bug fix
- Loading branch information
Showing
1 changed file
with
20 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,32 @@ | ||
name: Issue reminder workflow | ||
name: 'open-issue reminder' | ||
|
||
on: | ||
schedule: | ||
- cron: "30 2 * * *" | ||
|
||
- cron: '15 4 * * *' | ||
jobs: | ||
stale: | ||
welcome: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Reminder message | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Run script | ||
uses: actions/github-script@v4 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const { context, github } = require('@actions/github'); | ||
const message = 'Hi there! This issue is still open. We are looking forward to your response.'; | ||
github.issues.listForRepo({ | ||
owner: 'Curious-Ecosystem', | ||
repo: 'Curious-Connect', | ||
const { data: issues } = await github.issues.listForRepo({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
state: 'open' | ||
}).then(async (response) => { | ||
for (const issue of response.data) { | ||
const { data: assignees } = await github.issues.listAssignees({ | ||
owner: 'Curious-Ecosystem', | ||
repo: 'Curious-Connect', | ||
issue_number: issue.number | ||
}); | ||
const assigneeLogins = assignees.map(assignee => '@' + assignee.login).join(' '); | ||
github.issues.createComment({ | ||
owner: 'Curious-Ecosystem', | ||
repo: 'Curious-Connect', | ||
issue_number: issue.number, | ||
body: `${message}\n\nAssignees: ${assigneeLogins}` | ||
}); | ||
} | ||
}).catch((error) => { | ||
console.error(error); | ||
process.exit(1); | ||
}); | ||
for (const issue of issues) { | ||
const issueComment = `Hi there! This issue is still open. We are looking forward to your response. | ||
Assignees: ${issue.assignees.map(assignee => '@' + assignee.login).join(', ') || 'None'}`; | ||
await github.issues.createComment({ | ||
issue_number: issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: issueComment | ||
}); | ||
} |