-
Notifications
You must be signed in to change notification settings - Fork 447
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
added non-core-qn workflow #8889
Conversation
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
const isOrgMember = orgMembers.some(member => member.login === commenter); | ||
if (!isOrgMember) { | ||
const commentBody = context.payload.comment.body.toLowerCase(); | ||
const questionKeywords = ["?", "what", "how", "why", "when", "who"]; |
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.
This should be a config that can be read from our variable in GitHub
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.
resolved.
issue_number: context.payload.issue.number, | ||
labels: ['question'], | ||
}); | ||
const slackWebhook = process.env.SLACK_WEBHOOK; |
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.
Test if this is working
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.
also this should go into a specific channel
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.
tested and we can add the channel webhook as a secret.
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
issue_number: context.payload.issue.number, | ||
labels: ['question'], |
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.
The labels to add should also be part of the variable. https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/store-information-in-variables
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.
added as a variable that can be added in the gh variables section.
const { data: orgMembers } = await github.orgs.listMembers({ | ||
org: context.repo.owner, | ||
role: 'all' | ||
}); | ||
const isOrgMember = orgMembers.some(member => member.login === commenter); |
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.
This should be an array of usernames that we set as a variable.
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.
updated.
@tellmeY18 status 🤔 |
@coderabbitai full review |
✅ Actions performedFull review triggered. |
WalkthroughA new GitHub Actions workflow file named Changes
Assessment against linked issues
Possibly related PRs
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
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.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (2)
.github/workflows/notify-non-core-qn.yml (2)
13-17
: Consider using GitHub Variables instead of Secrets for non-sensitive configurations.While secrets provide good security, they're primarily intended for sensitive data. For better maintainability and easier configuration updates, consider:
- Moving
ALLOWED_USERNAMES
,QUESTION_KEYWORDS
, andQUESTION_LABELS
to GitHub Variables- Keep only
SLACK_WEBHOOK
as a secret since it's sensitive- env: - ALLOWED_USERNAMES: ${{ secrets.ALLOWED_USERNAMES }} - QUESTION_KEYWORDS: ${{ secrets.QUESTION_KEYWORDS }} - QUESTION_LABELS: ${{ secrets.QUESTION_LABELS }} - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} + env: + ALLOWED_USERNAMES: ${{ vars.ALLOWED_USERNAMES }} + QUESTION_KEYWORDS: ${{ vars.QUESTION_KEYWORDS }} + QUESTION_LABELS: ${{ vars.QUESTION_LABELS }} + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
24-25
: Add rate limiting for comment processing.To prevent potential abuse, consider adding rate limiting for processing comments from non-core members.
script: | console.log('Script started'); + // Rate limiting check + const rateLimitResponse = await github.rest.rateLimit.get(); + if (rateLimitResponse.data.resources.core.remaining < 100) { + console.log('Rate limit too low, skipping processing'); + return; + } + const commenter = context.payload.comment.user.login;Also applies to: 31-33
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/notify-non-core-qn.yml
(1 hunks)
🔇 Additional comments (2)
.github/workflows/notify-non-core-qn.yml (2)
1-9
: LGTM! Workflow configuration is well-structured.
The workflow trigger and permissions are appropriately configured for the intended functionality.
1-80
: Verify workflow functionality with test cases.
Please ensure the workflow is tested with the following scenarios:
- Comment from core team member (should be ignored)
- Comment from non-core member without question (should be ignored)
- Comment from non-core member with question (should trigger labels and notification)
- Comment with special characters in the question
- Error scenarios (invalid webhook, permission issues)
const issueUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/issues/${context.payload.issue.number}`; | ||
const issueTitle = context.payload.issue.title; | ||
const issueNumber = context.payload.issue.number; | ||
console.log('Issue URL:', issueUrl); |
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.
I don't think we should keep these logs
ALLOWED_USERNAMES: ${{ vars.ALLOWED_USERNAMES }} | ||
QUESTION_KEYWORDS: ${{ vars.QUESTION_KEYWORDS }} | ||
QUESTION_LABELS: ${{ vars.QUESTION_LABELS }} | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} |
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.
The steps should be skipped if the variables/ secrets are not available
@tellmeY18 Your efforts have helped advance digital healthcare and TeleICU systems. 🚀 Thank you for taking the time out to make CARE better. We hope you continue to innovate and contribute; your impact is immense! 🙌 |
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit