-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Olga Bulat <[email protected]> Co-authored-by: Dhruv Bhanushali <[email protected]>
- Loading branch information
1 parent
bd77fb5
commit fa632e6
Showing
3 changed files
with
62 additions
and
33 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 |
---|---|---|
|
@@ -11,17 +11,28 @@ jobs: | |
name: Send Slack message | ||
runs-on: ubuntu-latest | ||
env: | ||
slack_url: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
discussion_url: ${{ github.event.discussion.html_url }} | ||
discussion_number: ${{ github.event.discussion.number }} | ||
discussion_title: ${{ github.event.discussion.title }} | ||
discussion_author: ${{ github.event.discussion.user.login }} | ||
discussion_repo: ${{ github.event.repository.full_name }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
steps: | ||
- name: Send notification for new discussion | ||
run: | | ||
curl \ | ||
"$slack_url" \ | ||
-X POST \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{"text":"New discussion opened by '"$discussion_author"' in '"$discussion_repo"': #'"$discussion_number"' - '"$discussion_title"'","blocks":[{"type":"section","text":{"type":"mrkdwn","text":":github: New discussion opened by *'"$discussion_author"'* in `'"$discussion_repo"'`:\n<'"$discussion_url"'|#'"$discussion_number"' - '"$discussion_title"'>"}}]}' | ||
id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"text": "New discussion opened by ${{ env.discussion_author }} in ${{ env.discussion_repo }}: #${{ env.discussion_number }} - ${{ env.discussion_title }}", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": ":github: New discussion opened by *${{ env.discussion_author }}* in ${{ env.discussion_repo }}:\n<${{ env.discussion_url }}|#${{ env.discussion_number }} - ${{ env.discussion_title }}>" | ||
} | ||
} | ||
] | ||
} |
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 |
---|---|---|
|
@@ -29,19 +29,17 @@ jobs: | |
if: ${{ needs.analyze-user-prs.outputs.pr_count >= 3 }} | ||
runs-on: ubuntu-latest | ||
env: | ||
slack_url: ${{ secrets.SLACK_DM_WEBHOOK_URL }} | ||
pr_count: ${{ needs.analyze-user-prs.outputs.pr_count }} | ||
slack_id: ${{ needs.analyze-user-prs.outputs.slack_id }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
steps: | ||
- name: Send notification | ||
run: | | ||
msg="Hi, Opener! \nYou currently have $pr_count Pull Request(s) open with requested reviews (totalling $((pr_count * 2)) required reviews). \nTo help ease the review burden, increase review velocity for older PRs, and improve the equitable distribution of project maintenance tasks across the team, please consider reviewing this list of ways to contribute instead of working on new code contributions: \nhttps://docs.openverse.org/meta/maintainer_tasks.html" | ||
curl \ | ||
"$slack_url" \ | ||
-X POST \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{ | ||
"user": "'"$slack_id"'", | ||
"message": "'"$msg"'" | ||
}' | ||
id: slack | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"user": "${{ env.slack_id }}", | ||
"message": "Hi, Opener! \nYou currently have ${{ env.pr_count }} Pull Request(s) open with requested reviews (totalling $((${{ env.pr_count }} * 2)) required reviews). \nTo help ease the review burden, increase review velocity for older PRs, and improve the equitable distribution of project maintenance tasks across the team, please consider reviewing this list of ways to contribute instead of working on new code contributions: \nhttps://docs.openverse.org/meta/maintainer_tasks.html" | ||
} |
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 |
---|---|---|
|
@@ -15,30 +15,50 @@ jobs: | |
!startsWith(github.event.pull_request.title, '🔄') | ||
runs-on: ubuntu-latest | ||
env: | ||
slack_url: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
pr_url: ${{ github.event.pull_request.html_url }} | ||
pr_number: ${{ github.event.pull_request.number }} | ||
pr_title: ${{ github.event.pull_request.title }} | ||
pr_author: ${{ github.event.pull_request.user.login }} | ||
pr_repo: ${{ github.event.pull_request.base.repo.full_name }} | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK | ||
steps: | ||
- name: Send notification for new PR | ||
if: github.event.action == 'opened' | ||
id: slack | ||
uses: slackapi/[email protected] | ||
env: | ||
pr_status: ${{ github.event.pull_request.draft && ' draft ' || ' ' }} | ||
pr_icon: ${{ github.event.pull_request.draft && ':pr-draft:' || ':pull-request:' }} | ||
run: | | ||
curl \ | ||
"$slack_url" \ | ||
-X POST \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{"text":"New'"$pr_status"'PR opened by '"$pr_author"' in '"$pr_repo"': #'"$pr_number"' - '"$pr_title"'","blocks":[{"type":"section","text":{"type":"mrkdwn","text":"'"$pr_icon"' New'"$pr_status"'PR opened by *'"$pr_author"'* in `'"$pr_repo"'`:\n<'"$pr_url"'|#'"$pr_number"' - '"$pr_title"'>"}}]}' | ||
with: | ||
payload: | | ||
{ | ||
"text": "New \"${{ env.pr_status }}\" PR opened by \"${{ env.pr_author }}\" in \"${{ env.pr_repo }}\": #\"${{ env.pr_number }}\" - \"${{ env.pr_title }}\"", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "\"${{ env.pr_icon }}\" New\"${{ env.pr_status }}\"PR opened by *\"${{ env.pr_author }}\"* in `\"${{ env.pr_repo }}\"`:\n<\"${{ env.pr_url }}\"|#\"${{ env.pr_number }}\" - \"${{ env.pr_title }}\">" | ||
} | ||
} | ||
] | ||
} | ||
- name: Send notification for PR marked ready | ||
if: github.event.action == 'ready_for_review' | ||
run: | | ||
curl \ | ||
"$slack_url" \ | ||
-X POST \ | ||
-H 'Content-Type: application/json' \ | ||
-d '{"text":"PR by '"$pr_author"' in '"$pr_repo"' marked ready for review: #'"$pr_number"' - '"$pr_title"'","blocks":[{"type":"section","text":{"type":"mrkdwn","text":":pull-request: PR by *'"$pr_author"'* in `'"$pr_repo"'` marked ready for review:\n<'"$pr_url"'|#'"$pr_number"' - '"$pr_title"'>"}}]}' | ||
id: slack-notifications | ||
uses: slackapi/[email protected] | ||
with: | ||
payload: | | ||
{ | ||
"text": "PR by \"${{ env.pr_author }}\" in \"${{ env.pr_repo }}\" marked ready for review: #${{ env.pr_number }} - \"${{ env.pr_title }}\"", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": ":pull-request: PR by *${{ env.pr_author }}* in `${{ env.pr_repo }}` marked ready for review:\n<${{ env.pr_url }}|#${{ env.pr_number }} - ${{ env.pr_title }}>" | ||
} | ||
} | ||
] | ||
} |