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

Replaced cURL slack workflows with slackapi #3577

Merged
merged 34 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 33 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
fd7a295
- modified files to use slackapi for github workglow
The5cheduler Dec 21, 2023
70f358c
Merge branch 'WordPress:main' into main
The5cheduler Dec 21, 2023
d184028
- added original for the step
The5cheduler Dec 21, 2023
7df004c
- removed curl and applied slackapi
The5cheduler Dec 23, 2023
24e9580
Merge branch 'WordPress:main' into main
The5cheduler Dec 23, 2023
e7eeafc
Update Slack notification ID in PR ping workflow
The5cheduler Dec 23, 2023
f9f616a
Refactor GitHub Action payloads
The5cheduler Dec 23, 2023
cfeacbb
Update .github/workflows/discussion_ping.yml
obulat Dec 26, 2023
7dfe914
Update .github/workflows/pr_limit_reminders.yml
obulat Dec 26, 2023
a494f65
Update .github/workflows/pr_ping.yml
obulat Dec 26, 2023
2ec6ace
Remove trailing spaces to pass lint check
dhruvkb Dec 26, 2023
e18e3e4
Merge branch 'WordPress:main' into main
The5cheduler Dec 26, 2023
fb1db2e
Merge branch 'WordPress:main' into main
The5cheduler Dec 27, 2023
811ef8e
Merge branch 'WordPress:main' into main
The5cheduler Dec 30, 2023
7c71dda
fixed the vatiables discussion_ping.yml
The5cheduler Dec 30, 2023
ad3b37e
added variables and fixed the slack action api version for discussion…
The5cheduler Dec 30, 2023
d04fc98
added variables and fixed the slack action api version for pr_ping.yml
The5cheduler Dec 30, 2023
49dbd72
added variables and fixed the slack action api version for pr_limit_r…
The5cheduler Dec 31, 2023
bec2a53
Update discussion ping message variables
The5cheduler Dec 31, 2023
62fd6c3
Update Slack message format in PR limit reminders and PR ping workflows
The5cheduler Dec 31, 2023
190f1e2
Fix multiplication syntax in Slack message
The5cheduler Dec 31, 2023
793a6ca
Fix formatting in discussion_ping.yml
The5cheduler Dec 31, 2023
bcaae46
Update discussion_ping.yml to include additional notification message
The5cheduler Dec 31, 2023
174e516
Fixing linting issue
The5cheduler Dec 31, 2023
38de286
Update discussion ping message format
The5cheduler Dec 31, 2023
3db9221
Update variable names in GitHub workflow files
The5cheduler Dec 31, 2023
826006b
Merge branch 'WordPress:main' into main
The5cheduler Jan 2, 2024
704da9e
Update variable names in GitHub workflows
The5cheduler Jan 2, 2024
0cb727a
Fixed the variable Names added env. as Prefix
The5cheduler Jan 2, 2024
d7b0f28
Merge branch 'WordPress:main' into main
The5cheduler Jan 3, 2024
43963f0
Merge branch 'WordPress:main' into main
The5cheduler Jan 6, 2024
3a22a22
Merge branch 'WordPress:main' into main
The5cheduler Jan 8, 2024
6a9ba9e
Merge branch 'WordPress:main' into main
The5cheduler Jan 8, 2024
81ac6d7
- removed the unused env variables
The5cheduler Jan 8, 2024
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
24 changes: 18 additions & 6 deletions .github/workflows/discussion_ping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,23 @@ jobs:
discussion_title: ${{ github.event.discussion.title }}
The5cheduler marked this conversation as resolved.
Show resolved Hide resolved
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 }}>"
}
}
]
}
21 changes: 10 additions & 11 deletions .github/workflows/pr_limit_reminders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,15 @@ jobs:
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"
}
47 changes: 34 additions & 13 deletions .github/workflows/pr_ping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,45 @@ jobs:
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 }}>"
}
}
]
}
Loading