Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9362b2a
commit 8188737
Showing
6 changed files
with
194 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Slack P/R Approved notification | ||
|
||
on: | ||
pull_request_review: | ||
types: [submitted] | ||
|
||
jobs: | ||
approved: | ||
if: github.event.review.state == 'approved' | ||
runs-on: ubuntu-latest | ||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
|
||
# Runs the Slack webhook notify action to send a notification | ||
- name: Slack Notify | ||
uses: slackapi/slack-github-action@v1.24.0 | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
with: | ||
channel-id: 'github-flows' | ||
payload: | | ||
{ | ||
"text": "✅ ᴀᴘᴘʀᴏᴠᴇᴅ : <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}> was approved by ${{ github.actor }}" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Slack P/R Merged notification | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
|
||
jobs: | ||
if_merged: | ||
if: github.event.pull_request.merged | ||
runs-on: ubuntu-latest | ||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
|
||
# Runs the Slack webhook notify action to send a notification | ||
- name: Slack Notify | ||
uses: slackapi/slack-github-action@v1.24.0 | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
with: | ||
channel-id: 'github-flows' | ||
payload: | | ||
{ | ||
"text": "⤵️ ᴍᴇʀɢᴇᴅ : <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Slack P/R Request OPEN | ||
|
||
on: | ||
pull_request_review: | ||
types: [submitted] | ||
|
||
jobs: | ||
changesrequested: | ||
if: github.event.review.state == 'changes_requested' | ||
runs-on: ubuntu-latest | ||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
|
||
# Runs the Slack webhook notify action to send a notification | ||
- name: Slack Notify | ||
uses: slackapi/slack-github-action@v1.24.0 | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
with: | ||
channel-id: 'github-flows' | ||
payload: | | ||
{ | ||
"text": " ➡️ ᴏᴘᴇɴ : <${{ github.event.pull_request.html_url }}|{{ github.event.pull_request.title }}> \nAuthor: ${{ github.actor }}" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Slack Push Notification | ||
|
||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize] | ||
|
||
jobs: | ||
notify: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Find Pull Request | ||
id: find_pr | ||
run: | | ||
# Get the pull request number and title | ||
pr_number=$(jq --raw-output .number $GITHUB_EVENT_PATH) | ||
pr_title=$(jq --raw-output .pull_request.title $GITHUB_EVENT_PATH) | ||
pr_html_url=$(jq --raw-output .pull_request.html_url $GITHUB_EVENT_PATH) | ||
# Set the output variables | ||
echo "::set-output name=pull_request_number::$pr_number" | ||
echo "::set-output name=pull_request_title::$pr_title" | ||
echo "::set-output name=pull_request_html_url::$pr_html_url" | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
with: | ||
ref: ${{ github.event.pull_request.head.ref }} | ||
|
||
- name: Get Latest Commit Message and URL | ||
id: commit_info | ||
run: | | ||
COMMIT_MESSAGE=$(git log --format=%B -n 1) | ||
COMMIT_URL=$(git log --format=%H -n 1) | ||
NUM_FILES_CHANGED=$(git --no-pager diff --name-only origin/main...${{ github.event.pull_request.base.ref }} | wc -l) | ||
echo ::set-output name=num_files_changed::$NUM_FILES_CHANGED | ||
echo ::set-output name=commit_message::$COMMIT_MESSAGE | ||
echo ::set-output name=commit_url::https://github.com/${{ github.repository }}/commit/${COMMIT_URL} | ||
echo ::set-output name=files_url::https://github.com/${{ github.repository }}/pull/${{ steps.find_pr.outputs.pull_request_number }}/files | ||
- name: Slack Notify | ||
uses: slackapi/slack-github-action@v1.24.0 | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
with: | ||
channel-id: 'github-flows' | ||
payload: | | ||
{ | ||
"text": "⬆️ Push on branch: <https://github.com/mintbase/mintbase-js/tree/${{ github.head_ref }}|${{ github.head_ref }}>\nPR: [mintbase-js] <${{ github.event.pull_request.html_url }}|#${{ steps.find_pr.outputs.pull_request_number }} ${{ github.event.pull_request.title }}>\nCommit: <${{ steps.commit_info.outputs.commit_url }} | ${{ steps.commit_info.outputs.commit_message }}>\nAuthor: ${{ github.actor }}" | ||
} |
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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Slack P/R Request Changes notification | ||
|
||
on: | ||
pull_request_review: | ||
types: [submitted] | ||
|
||
jobs: | ||
changesrequested: | ||
if: github.event.review.state == 'changes_requested' | ||
runs-on: ubuntu-latest | ||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
|
||
# Runs the Slack webhook notify action to send a notification | ||
- name: Slack Notify | ||
uses: slackapi/slack-github-action@v1.24.0 | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
with: | ||
channel-id: 'github-flows' | ||
payload: | | ||
{ | ||
"text": "♻️ [REQUESTED CHANGES] : <${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>\nBy:${{ github.actor }} " | ||
} |
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 |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Slack P/R Review and Comment notification | ||
|
||
on: | ||
pull_request_review: | ||
types: [submitted] | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
notify: | ||
runs-on: ubuntu-latest | ||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
|
||
# Determine the type of event (review or comment) and set the notification message accordingly | ||
- name: Set Notification Message | ||
id: set_message | ||
run: | | ||
if [[ -n "${{ github.event.pull_request_review }}" ]]; then | ||
echo "Review: ✉️ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) - ${{ github.event.review.user.login }} - ${{ github.event.review.state }}" | ||
echo ::set-output name=message::"Review: ✉️ [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) - ${{ github.event.review.user.login }} - ${{ github.event.review.state }}" | ||
elif [[ -n "${{ github.event.issue_comment }}" ]]; then | ||
echo "Comment: 💬 [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) - ${{ github.event.comment.user.login }}" | ||
echo ::set-output name=message::"Comment: 💬 [${{ github.event.pull_request.title }}](${{ github.event.pull_request.html_url }}) - ${{ github.event.comment.user.login }}" | ||
fi | ||
# Runs the Slack webhook notify action to send a notification | ||
- name: Slack Notify | ||
uses: slackapi/slack-github-action@v1.24.0 | ||
env: | ||
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} | ||
with: | ||
channel-id: 'github-flows' | ||
payload: | | ||
{ | ||
"text": ${{ steps.set_message.outputs.message }} | ||
} |