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

Notify our slack on contributors' issue comments #11564

Merged
merged 3 commits into from
Dec 11, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/notify_team_new_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Send a slack notification when a contributor comments on issue

on:
issue_comment:
types: [created]

jobs:
contributor_issue_comment:
name: Contributor issue comment

if: >-
${{
!github.event.issue.pull_request &&
github.event.comment.author_association != 'MEMBER' &&
github.event.comment.author_association != 'OWNER'
}}

runs-on: ubuntu-latest
steps:
- name: Send message to Slack channel
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
curl -X POST -H 'Content-type: application/json' \
--data \
'{"text": "New comment on issue: '${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/issues/${{ github.event.issue.number }}' by '${GITHUB_ACTOR}'"}' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible tweaks here:

  • Put the issue name instead of just 'issue'
  • Make a link out of the issue name
  • Update the link to include the reference to the specific comment so that clicking on it will open the issue at that specific comment
  • Could also make the github actor text link to the user profile of the github user.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've included the issue title and linked it to the specific comment. I have not added github profile user link because that would be unnecessary.

$SLACK_WEBHOOK_URL
Loading