Skip to content
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

Automate Labeling of Issues Based on Comments from Non-Core Members #8847

Closed
aravindm4 opened this issue Oct 21, 2024 · 1 comment · Fixed by #8889
Closed

Automate Labeling of Issues Based on Comments from Non-Core Members #8847

aravindm4 opened this issue Oct 21, 2024 · 1 comment · Fixed by #8889
Assignees

Comments

@aravindm4
Copy link

Is your feature request related to a problem? Please describe.
Currently, there is no way to track issues with unresolved comments. Contributors, interns, or anyone other than core team members may have shared a comment that requires action from the core team, but it might be missed, causing the issue to stall.

Describe the solution you'd like
To identify such cases, a label can be automatically added to the issue whenever someone other than a core team member comments.

Feature Requirements:

  • Automatically add a "question" label to an issue whenever a non-core team member comments.
  • Once a core team member replies or comments, the "question" label should be automatically removed.
@bodhish
Copy link
Member

bodhish commented Oct 22, 2024

@aravindm4 lets just add the tag, lets not make the removal automatic.

name: Notify Core Team on Non-Core Questions

on:
  issue_comment:
    types: [created]

jobs:
  notify_core_team:
    runs-on: ubuntu-latest
    steps:
      - name: Check if commenter is non-core member
        uses: actions/github-script@v6
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            const coreMembers = ['coreMember1', 'coreMember2']; // Define core members
            const commenter = context.payload.comment.user.login;
            if (!coreMembers.includes(commenter)) {
              return commenter; // Proceed if not core member
            }

      - name: Check if comment is a question
        id: check_question
        run: |
          echo "${{ github.event.comment.body }}" | grep -Eq "(\?|what|how|why|when|who)"
        
      - name: Notify core team
        if: ${{ steps.check_question.outcome == 'success' }}
        run: |
          curl -X POST -H 'Content-type: application/json' --data '{"text":"A non-core member posted a question: https://github.com/${{ github.repository }}/issues/${{ github.event.issue.number }}"}' ${{ secrets.SLACK_WEBHOOK }}

      - name: Add question label (optional)
        if: ${{ steps.check_question.outcome == 'success' }}
        uses: actions/github-script@v6
        with:
          github-token: ${{ secrets.GITHUB_TOKEN }}
          script: |
            await github.issues.addLabels({
              owner: context.repo.owner,
              repo: context.repo.repo,
              issue_number: context.payload.issue.number,
              labels: ['question'],
            });

Something like this with options for questions and core configurable via actions env

@tellmeY18 tellmeY18 self-assigned this Nov 12, 2024
@tellmeY18 tellmeY18 added this to Care Nov 12, 2024
@github-project-automation github-project-automation bot moved this to Triage in Care Nov 12, 2024
@tellmeY18 tellmeY18 moved this from Triage to In Progress in Care Nov 12, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Care Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants