Skip to content

Commit

Permalink
Merge pull request #4 from vaisakhkannan/Issue-45-Slack-Github-Integr…
Browse files Browse the repository at this point in the history
…ation

Added code
  • Loading branch information
vaisakhkannan authored Apr 30, 2024
2 parents b258f7e + 2ce56cb commit 3fec9df
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,27 +51,6 @@ jobs:
- name: 'Build Liberty-Tools-Intellij'
working-directory: ./liberty-tools-intellij
run: bash ./gradlew buildPlugin
- name: Send custom JSON data to Slack workflow
id: slack
uses: slackapi/[email protected]
with:
# For posting a rich message using Block Kit
payload: |
{
"text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- name: 'Archive artifacts'
if: ${{ runner.os == 'Linux' && !failure() }}
uses: actions/upload-artifact@v3
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PR notification
on:
pull_request:
types: [ opened , reopened ]

jobs:
new_push_job:
runs-on: ${{ matrix.os }}
name: PR creation
steps:
- name: Send GitHub trigger payload to Slack Workflow Builder
id: slack
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "GitHub Action PR opened: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

0 comments on commit 3fec9df

Please sign in to comment.