-
Notifications
You must be signed in to change notification settings - Fork 357
feat: add issue automation workflow and script #1367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add issue automation workflow and script #1367
Conversation
|
@roshankumar0036singh is attempting to deploy a commit to the avdheshvarshney's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
Thank you for submitting your pull request! We'll review it as soon as possible. For further communication, join our discord server https://discord.gg/tSqtvHUJzE. |
|
@Avdhesh-Varshney plz review it i couldnt test the functionality so just tested it locally by creating test file and mimicing the github triggers |
Avdhesh-Varshney
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. Need to check whether we can process the github project using this workflow. https://github.com/orgs/Code-A2Z/projects/1
.github/scripts/issue-automation.js
Outdated
|
|
||
| await assignUser(issue.number, username); | ||
| await addLabels(issue.number, ['Status: Assigned']); | ||
| await removeLabel(issue.number, 'up-for-grabs'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just assign to user, Don't add labels.
If possible to update the status of issue in OS - TASK TRACKER (view), try to update.
.github/scripts/issue-automation.js
Outdated
|
|
||
| const username = issue.user.login; | ||
|
|
||
| if (await checkUserAssignmentLimit(username)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create variable for await. It may breaks the if condition as promise is always true
.github/scripts/issue-automation.js
Outdated
|
|
||
| const username = comment.user.login; | ||
|
|
||
| if (await checkUserAssignmentLimit(username)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
.github/scripts/issue-automation.js
Outdated
|
|
||
| await assignUser(issue.number, username); | ||
| await addLabels(issue.number, ['Status: Assigned']); | ||
| await removeLabel(issue.number, 'up-for-grabs'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove labels
.github/scripts/issue-automation.js
Outdated
|
|
||
| // Handle Scheduled Deadline Checks | ||
| if (context.eventName === 'schedule') { | ||
| // Fetch all open issues with 'Status: Assigned' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to fetch from OS - TASK TRACKER (view) project. Otherwise check all opened issues.
.github/scripts/issue-automation.js
Outdated
| const warningDate = new Date(deadline); | ||
| warningDate.setDate(deadline.getDate() - 1); | ||
|
|
||
| const assignee = issue.assignees.length > 0 ? issue.assignees[0].login : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you check the latest contributor is always at 0th index?
Or can we not get it from events variable? (That to be more accurate)
.github/scripts/issue-automation.js
Outdated
|
|
||
| if (labels.includes('priority: high')) daysAllowed = 3; | ||
| else if (labels.includes('priority: medium')) daysAllowed = 6; | ||
| else if (labels.includes('priority: low')) daysAllowed = 8; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check able to check the priority from OS - TASK TRACKER (view) project?
And also check is it possible to set start date and end date of the issue, according to How much time should be allocated to this issue? question in issue template.
Feel free to modify the issue template to update setup this workflow.
|
|
||
| on: | ||
| issues: | ||
| types: [opened, edited, reopened, assigned, unassigned] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove assigned and unassigned events
647f72a to
4b30fb7
Compare
|
@Avdhesh-Varshney check now i have tried to use the os tracker but we need to test it one time as i cant test it locally |
4b30fb7 to
3fe26d3
Compare
|
@roshankumar0036singh Your earlier contribution was awesome. Please keep the same consistency.
|
|
@Avdhesh-Varshney i worked on it but currently it is using the github token which normally cant wrtie to the organisation level project we might need to use pat |
|
@roshankumar0036singh pat? - personal token? If personal token, do you say We need to write it hard-coded in workflow? or need to setup in settings? |
|
@Avdhesh-Varshney need to setup as a New repository secret in settings and whatever name you used for it give me that name |
|
token is encrypted in GitHub's secret storage ,It's never visible in logs or code |
|
|
|
@Avdhesh-Varshney need this scopes for pat project , read and write and did you added it as a Repository Secret |
|
Addedas repository secret. |
0270d15 to
6499989
Compare
6499989 to
219c683
Compare
|
@Avdhesh-Varshney check now there was slight issue this code formating issue if from earlier commit made to the code-a2z repo not by my commit |
- Auto-assign issues when users select 'Yes' in issue form - Support /assign command for manual assignment - Enforce 2-issue limit per user - Daily deadline checks with priority-based timeouts (3/6/8 days) - Warning notifications 24h before deadline - Project V2 integration with OS - TASK TRACKER - Idempotent project sync with status updates - Comprehensive error handling and logging - Production-ready workflow with timeouts and concurrency control
- Auto-assign issues when users select 'Yes' in issue form - Support /assign command for manual assignment - Enforce 2-issue limit per user - Daily deadline checks with priority-based timeouts (3/6/8 days) - Warning notifications 24h before deadline - Project V2 integration with OS - TASK TRACKER - Idempotent project sync with status updates - Comprehensive error handling and logging - Production-ready workflow with timeouts and concurrency control
087e2a7 to
ced2f15
Compare
|
@roshankumar0036singh Yes that was due to some earlier commits. |
Pull Requests Review Criteria
Caution
PRs that fail to meet these review standards will be automatically flagged and may be rejected by maintainers.
mainCloses:
closes #1072
Describe the add-ons or changes you've made 📃
I have implemented a comprehensive GitHub Issue Automation system to streamline contribution management.
Key Features:
/assignCommand: Allows contributors to claim issues by commenting/assign.Files Added:
.github/workflows/issue-automation.yml: Defines triggers (issues, comments, schedule)..github/scripts/issue-automation.js: Contains the logic for assignment and deadline checks.Screenshots 📷
The logic has been verified using a local test harness to mock GitHub events. The workflow requires
issues: writepermissions which have been added.